#86 dasherize

Emad Ibrahim
Oct 6, 2016 ยท 1 min read

Most of you probably already know this but here it is anyway. Ember has a built-in dasherize function that replaces underscores, spaces, or camelCase with dashes.

Here are examples straight from the ember docs:

'innerHTML'.dasherize();          // 'inner-html'
'action_name'.dasherize(); // 'action-name'
'css-class-name'.dasherize(); // 'css-class-name'
'my favorite items'.dasherize(); // 'my-favorite-items'
'privateDocs/ownerInvoice'.dasherize(); // 'private-docs/owner-invoice

Originally published at Ember Daily Tips.

Emad Ibrahim

Written by

Husband, Father of Twins, Published Author, Entrepreneur, Passionate Technologist, Programmer and Productivity Nut. more at https://about.me/eibrahim