本文整理匯總了TypeScript中@ember/string.dasherize函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript dasherize函數的具體用法?TypeScript dasherize怎麽用?TypeScript dasherize使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了dasherize函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: classHelper
function classHelper({ positional }: any) {
let path = positional.at(0);
let args = positional.length;
let value = path.value();
if (value === true) {
if (args > 1) {
return dasherize(positional.at(1).value());
}
return null;
}
if (value === false) {
if (args > 2) {
return dasherize(positional.at(2).value());
}
return null;
}
return value;
}
示例2: normalizeClass
function normalizeClass({ positional }: any) {
let classNameParts = positional
.at(0)
.value()
.split('.');
let className = classNameParts[classNameParts.length - 1];
let value = positional.at(1).value();
if (value === true) {
return dasherize(className);
} else if (!value && value !== 0) {
return '';
} else {
return String(value);
}
}
示例3: dasherize
source: [...Array(10)].map(() => dasherize(faker.lorem.words().toLowerCase()))
示例4: dasherize
import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w, isHTMLSafe } from '@ember/string';
import { SafeString } from '@ember/string/-private/handlebars';
dasherize(); // $ExpectError
dasherize('blue man group'); // $ExpectType string
dasherize('', ''); // $ExpectError
camelize(); // $ExpectError
camelize('blue man group'); // $ExpectType string
camelize('', ''); // $ExpectError
decamelize(); // $ExpectError
decamelize('blue man group'); // $ExpectType string
decamelize('', ''); // $ExpectError
underscore(); // $ExpectError
underscore('blue man group'); // $ExpectType string
underscore('', ''); // $ExpectError
w(); // $ExpectError
w('blue man group'); // $ExpectType string[]
w('', ''); // $ExpectError
classify(); // $ExpectError
classify('blue man group'); // $ExpectType string
classify('', ''); // $ExpectError
capitalize(); // $ExpectError
capitalize('blue man group'); // $ExpectType string
capitalize('', ''); // $ExpectError