meta.function-exists($name, $module: null) returns a boolean: whether a function named $name is defined—either as a built-in or a user-defined function. Load it with @use "sass:meta".
Official samples.
meta.function-exists("div", $module: "math") → true · meta.function-exists("scale-color") → true · meta.function-exists("add") → false until you define @function add.
Pass $module for namespaces.
After @use "sass:math", check module members with $module: "math". The $module value can also be a module value.
Pair with get-function / call when you need to invoke.
Preferred over feature-exists for API detection.
One line: when you need to know if a function name is defined before using it, call meta.function-exists($name, $module: null).
Practice
Compile Notes
Practical checklist:
checklist.txt
1. @use "sass:meta"
2. Pass the function name as a string
3. Add $module for @use namespaces
4. Branch on the boolean result
5. Use get-function + call to invoke
Frequently Asked Questions
meta.function-exists($name, $module: null) returns true if a function named $name is defined as a built-in or user-defined function, otherwise false.
When the function lives in a @use namespace. $module must match that namespace string—for example meta.function-exists("div", $module: "math") after @use "sass:math".
function-exists only answers yes/no. get-function returns the function value so you can run it with meta.call. Use exists first if you need a safe optional path.
function-exists looks for functions. mixin-exists looks for mixins. Same idea, different member type.
Yes for detecting APIs. Official docs recommend function-exists, mixin-exists, and global-variable-exists instead of the deprecated feature-exists helper.
Yes. function-exists($name) is the legacy global form (no $module). Prefer meta.function-exists after @use "sass:meta".