npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

extract-snippet

0.1.0

@jonschlinkert

npmHomeRepoSnykSocket
Downloads:11
$ npm install extract-snippet
DailyWeeklyMonthlyYearly

extract-snippet NPM version

Extract a snippet of code from a string.

Install

Install with npm

$ npm i extract-snippet --save

Usage

var extract = require('extract-snippet');

extract a snippet

var a = 'a <!-- snippet -->\nfoo\n<!-- endsnippet --> b';
extract(a);
//=> 'foo'

var b = 'a <!-- snippet -->a b c<!-- endsnippet --> b';
extract(b);
//=> 'a b c'

custom delimiters

var str = 'a {{snippet}}\nfoo\n{{endsnippet}} b';
extract(str, {delimiters: ['{{', '}}']});
//=> 'foo'

Related projects

  • assemble: Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… more
  • inject-snippet: Inject a snippet of code or content into a string.
  • snippet: CLI and API for easily creating, reusing, sharing and generating snippets of code from the… more
  • scaffold: Generate a project or files from scaffolds.
  • verb: Documentation generator for GitHub projects. Extremely powerful, easy to use, can generate anything from API… more

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

  • github/jonschlinkert
  • twitter/jonschlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on August 17, 2015.