Skip to content

joshgillies/function-stringify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Stringify functions, or more specifically their comments!

Resources

License

Stars

Watchers

Forks

Packages

No packages published