function-stringify
v1.3.0
Published
Stringify functions, or more specifically their comments!
Downloads
2
Maintainers
Readme
function-stringify
Stringify functions, or more specifically their comments!
You know, because you might want a function body to store something other than just JavaScript.
Install
npm install function-stringify
Example
var fnStringify = require('function-stringify')
var template = fnStringify(function () {/*
<!DOCTYPE html>
<html>
<head>
<title>Welcome to The Internet</title>
</head>
<body>
<h1>Hello, world!</h1>
</body>
</html>
*/}, true)
console.log(template)
Usage
var fnStringify = require('function-stringify')
fnStringify(fn, format)
fn
is a function declaration whose body contains a comment block in the format of /* content */
.
format
is a boolean flag which when set to true fnStringify
will attempt to preserve the formatting of the enclosed content string.
License
MIT