Skip to content

Documentation / @ember-data/request-utils / string / underscore

ts
function underscore(str): string;

Defined in: -private/string/transform.ts:157

Returns the lower_case_and_underscored form of a string.

js
import { underscore } from '@ember-data/request-utils/string';

underscore('innerHTML');                 // 'inner_html'
underscore('action_name');               // 'action_name'
underscore('css-class-name');            // 'css_class_name'
underscore('my favorite items');         // 'my_favorite_items'
underscore('privateDocs/ownerInvoice');  // 'private_docs/owner_invoice'

Parameters

str

string

Returns

string

Since

4.13.0

Released under the MIT License.