Documentation / @warp-drive/utilities / string / underscore
Function: underscore()
ts
function underscore(str): string;
Defined in: utilities/src/-private/string/transform.ts:85
Returns the lower_case_and_underscored form of a string.
js
import { underscore } from '@warp-drive/utilities/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