Get a safe variable name from a given string.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.

lodash-mixin-safename NPM version

Get a safe variable name from a given string.

Getting Started

To install the module, run the following in the command line:

npm i lodash-mixin-safename --save

Use within your application with the following line of JavaScript:

var _ = require('lodash');



Type: String Default value: undefeined

The name to be modified


Type: Array Default value: []

List of patterns to be removed from the name.

Usage Examples

Example grunt-readme

"grunt-readme" => "readme"

var newName = _.safename('grunt-readme');

Example foo-bar

"foo-bar" => "bar"

var newName = _.safename('foo-bar', ['foo']);


Find a bug? Have a feature request? Please create an Issue.

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt, and build the documentation with grunt-readme.

Pull requests are also encouraged, and if you find this project useful please consider "starring" it to show your support! Thanks!


Jon Schlinkert

Brian Woodward


  • helpers: some great handlebars helpers that we decided not to include in the handlebars-helpers project, most likely because the code footprint was too big or the helper wasn't generic enough.


Copyright (c) 2014 undefined, contributors. Released under the license

This file was generated by grunt-readme on Thursday, January 2, 2014.