本文整理汇总了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
})();