getFunctionExpressionString
Converts a function into a string that is a valid function expression.
Function.prototype.toString() on a shorthand method like { fn() {} } returns "fn() {}", which is not a valid expression. This helper detects that form and prefixes it with function .
Import:
import { getFunctionExpressionString } from 'obsidian-dev-utils/function';Signature:
function getFunctionExpressionString($function: Function): stringParameters:
| Parameter | Type | Description |
|---|---|---|
$function | Function |
Returns: string — A string that is a valid function expression.