本文整理匯總了TypeScript中@ember/utils.isPresent函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isPresent函數的具體用法?TypeScript isPresent怎麽用?TypeScript isPresent使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isPresent函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
return function() {
let currentValue = get(obj, prop);
if (isPresent(values)) {
let currentIdx = values.indexOf(currentValue);
let nextIdx = nextIndex(get(values, 'length'), currentIdx);
return set(obj, prop, values[nextIdx]);
}
return set(obj, prop, !currentValue);
};
示例2: createToast
createToast(status: string, msg: string, title: string, options: any) {
const message = isPresent(title) ? `${title}: ${msg}` : msg;
const colorClass = statusToClass(status);
this.notifications.addNotification({
autoClear: true,
clearDuration: Ember.testing ? 50 : 4000,
...options,
message: message || 'status',
type: status,
cssClasses: `
notification
${colorClass}
p-xs has-shadow height-tall`,
});
}
示例3: isPresent
(function() {
/** isPresent */
// TODO fix upstream in @types/ember https://github.com/typed-ember/ember-cli-typescript/issues/258
// isPresent(); // $ExpectType boolean
isPresent(null); // $ExpectType boolean
isPresent(undefined); // $ExpectType boolean
isPresent(''); // $ExpectType boolean
isPresent(' '); // $ExpectType boolean
isPresent('\n\t'); // $ExpectType boolean
isPresent([]); // $ExpectType boolean
isPresent({ length: 0 }); // $ExpectType boolean
isPresent(false); // $ExpectType boolean
isPresent(true); // $ExpectType boolean
isPresent('string'); // $ExpectType boolean
isPresent(0); // $ExpectType boolean
isPresent(function() {}); // $ExpectType boolean
isPresent({}); // $ExpectType boolean
isPresent(false); // $ExpectType boolean
isPresent('\n\t Hello'); // $ExpectType boolean
isPresent([1, 2, 3]); // $ExpectType boolean
})();
示例4: hasParams
private hasParams({ name, publicKey }: IQueryParams) {
// TODO: support additional / different params for private channels
return isPresent(name) && isPresent(publicKey);
}
示例5: isPresent
export function isPresent(params: any[] /*, hash*/) {
return eIsPresent(params[0]);
}
示例6: isChatVisible
get isChatVisible() {
return isPresent(this.chatName);
}
示例7: testIsPresent
function testIsPresent() {
utils.isPresent(); // $ExpectType boolean
utils.isPresent(''); // $ExpectType boolean
utils.isPresent('', ''); // $ExpectError
}
示例8: isPresent
(function() {
/** isPresent */
isPresent(); // $ExpectType boolean
isPresent(null); // $ExpectType boolean
isPresent(undefined); // $ExpectType boolean
isPresent(''); // $ExpectType boolean
isPresent(' '); // $ExpectType boolean
isPresent('\n\t'); // $ExpectType boolean
isPresent([]); // $ExpectType boolean
isPresent({ length: 0 }); // $ExpectType boolean
isPresent(false); // $ExpectType boolean
isPresent(true); // $ExpectType boolean
isPresent('string'); // $ExpectType boolean
isPresent(0); // $ExpectType boolean
isPresent(function() {}); // $ExpectType boolean
isPresent({}); // $ExpectType boolean
isPresent(false); // $ExpectType boolean
isPresent('\n\t Hello'); // $ExpectType boolean
isPresent([1, 2, 3]); // $ExpectType boolean
})();