Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joshgillies/function-stringify

Stringify functions, or more specifically their comments!
https://github.com/joshgillies/function-stringify

Last synced: 5 days ago
JSON representation

Stringify functions, or more specifically their comments!

Awesome Lists containing this project

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.

[![Build Status](https://travis-ci.org/joshgillies/function-stringify.svg)](https://travis-ci.org/joshgillies/function-stringify)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

## Install

`npm install function-stringify`

## Example

```js
var fnStringify = require('function-stringify')

var template = fnStringify(function () {/*



Welcome to The Internet


Hello, world!




*/}, true)

console.log(template)
```

## Usage

```js
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