Slugify a URL, path or heading id using the same format as GitHub heading anchors.
var slugify = require('helper-slugify');
Lo-Dash usage
Usage with lodash:
var template = require('lodash.template');
var options = {imports: {slugify: require('helper-slugify')}};
var str = template('<%= slugify("foo bar baz") %>', options)();
console.log(str);
//=> 'foo-bar-baz'
Engine usage
Usage with engine:
var Engine = require('engine');
var engine = new Engine();
engine.helper('slugify', require('helper-slugify'));
engine.render('<%= slugify("foo bar baz") %>');
console.log(str);
//=> 'foo-bar-baz'
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on July 19, 2016.