String#underscore()

underscore (str) Stringpublic

Defined in packages/ember-runtime/lib/system/string.js:300

More general than decamelize. Returns the lower_case_and_underscored form of a string.

1
2
3
4
5
'innerHTML'.underscore();          // 'inner_html'
'action_name'.underscore();        // 'action_name'
'css-class-name'.underscore();     // 'css_class_name'
'my favorite items'.underscore();  // 'my_favorite_items'
'privateDocs/ownerInvoice'.underscore(); // 'private_docs/owner_invoice'

Parameters:

str String
The string to underscore.

Returns:

String
the underscored string.
doc_EmberJs
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.