function-stringify

1.3.0 • Public • Published

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.

Build Status js-standard-style

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

Package Sidebar

Install

npm i function-stringify

Weekly Downloads

1

Version

1.3.0

License

MIT

Last publish

Collaborators

  • joshgillies