本文整理汇总了TypeScript中@phosphor/algorithm.some函数的典型用法代码示例。如果您正苦于以下问题:TypeScript some函数的具体用法?TypeScript some怎么用?TypeScript some使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了some函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should verify some items in an iterable satisfy a condition', () => {
let data = [1, 2, 3, 4, 5];
let valid = some(data, x => x > 4);
let invalid = some(data, x => x < 0);
expect(valid).to.equal(true);
expect(invalid).to.equal(false);
});
示例2: postMessage
function postMessage(handler: IMessageHandler, msg: Message): void {
// Handle the common case of a non-conflatable message.
if (!msg.isConflatable) {
enqueueMessage(handler, msg);
return;
}
// Conflate the message with an existing message if possible.
let conflated = some(messageQueue, posted => {
if (posted.handler !== handler) {
return false;
}
if (!posted.msg) {
return false;
}
if (posted.msg.type !== msg.type) {
return false;
}
if (!posted.msg.isConflatable) {
return false;
}
return posted.msg.conflate(msg);
});
// Enqueue the message if it was not conflated.
if (!conflated) {
enqueueMessage(handler, msg);
}
}
示例3: some
isEnabled: () => {
return some(
map(shell.widgets('main'), w => docManager.contextForWidget(w)),
c => c && c.contentsModel && c.contentsModel.writable
);
},