This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 1,000,000+ packages pre-installed, including
ember-string-parameterize with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
This is useful for creating slugs for your Ember.js routes. So useful that this feature was merged into Ember core with a feature flag, but later removed due to potential API bloat. Voice your opinion if you want it back, or, just use this!
ember.js in your app.
Or using package managers:
bower install ember-string-parameterize
npm install ember-string-parameterize
'My favorite movies.'.parameterize(); //=> 'my-favorite-movies' 'some_underscored_string'.parameterize(); //=> 'some-underscored-string' '100 ways Ember.js is better than Angular'.parameterize(); //=> '100-ways-emberjs-is-better-than-angular' '#emberjs Core Team Meeting Minutes - 2014/12/06'.parameterize(); //=> 'emberjs-core-team-meeting-minutes-2014-12-06'
'100 ways Ember.js is better than Angular'.parameterize(5); //=> '100-ways-emberjs-is-better' '100 ways Ember.js is better than Angular'.parameterize(-2); //=> '100-ways-emberjs-is-better'
Ember.String.parameterize('Using without extending prototypes!'); //=> 'using-without-extending-prototypes' Ember.String.parameterize('Using without extending prototypes!', 3); //=> 'using-without-extending'
It will also expose
StringParameterize to the browser's window object or node.js
StringParameterize('I work without Ember.js'); //=> 'i-work-without-emberjs' StringParameterize('I work without Ember.js', 2); //=> 'i-work'