inlinify
Preprocesses JavaScript functions so that they can be inlined as macros.
Example
var inline = //Preprocess a function for inliningvar inline_block = //Retrieve variablesconsoleconsoleconsoleconsole
require("inlinify")(func, prefix, args)
Preprocesses func so that it can be inlined into a block of code.
func
is the function to inlineprefix
is a string which is used to relabel all the variables in func to avoid conflictsargs
is the list of arguments forfunc
Returns An object with the following properties:
variables
a list of the local variables in functhis_variables
a list of variables in thethis
object of the funcbody
an inlinable string representing the body of the functionreturn_variable
the name of the return variable for the function
Credits
(c) 2013 Mikola Lysenko. MIT License