Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/inflection.js
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,26 @@
},


/**
* This function adds kebabize support to every String object.
* @public
* @function
* @param {String} str The subject string.
* @returns {String} Return camel cased words into kebab-case form.
* @example
*
* var inflection = require( 'inflection' );
*
* inflection.kebabize( 'MessageBusProperty' ); // === 'message-bus-property'
*/
kebabize : function ( str ){
str = inflector.underscore( str );
str = inflector.dasherize( str );

return str;
},



/**
* This function adds classification support to every String object.
Expand Down
7 changes: 7 additions & 0 deletions test/inflection.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ describe( 'test .tableize', function (){
});
});

describe( 'test .kebabize', function (){
it( 'should kebabize the given word', function (){
inflection.kebabize( 'people' ).should.equal( 'people' );
inflection.kebabize( 'MessageBusProperty' ).should.equal( 'message-bus-property' );
});
});

describe( 'test .classify', function (){
it( 'should classify the given word', function (){
inflection.classify( 'message_bus_properties' ).should.equal( 'MessageBusProperty' );
Expand Down