Open BobVarioa opened 3 years ago
Adds support for function based macros
Examples :
assert(jscc("$_HI()", '', { values: { _HI: () => "hi" } }).code === "hi") assert(jscc('$_HI("one", "two", "three")', '', { values: { _HI: (...args) => args.join(",") } }).code === "one,two,three") assert(jscc('$_HI("one", "two", "three")', '', { values: { _HI: "hi" } }).code === 'hi("one", "two", "three")') // doesn't change existing behavior of non functional values
Function based macros can only be a the top level (e.g. no $_LIB.fs.blah.read(/*etc.*/)) and arguments must be either a string or a number.
$_LIB.fs.blah.read(/*etc.*/)
I tried to keep the same style as your code and I wrote a few tests (but since they are so simple I didn't really know what else to test).
Adds support for function based macros
Examples :
Function based macros can only be a the top level (e.g. no
$_LIB.fs.blah.read(/*etc.*/)
) and arguments must be either a string or a number.I tried to keep the same style as your code and I wrote a few tests (but since they are so simple I didn't really know what else to test).