本文整理汇总了TypeScript中underscore.some函数的典型用法代码示例。如果您正苦于以下问题:TypeScript some函数的具体用法?TypeScript some怎么用?TypeScript some使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了some函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should move row 14 to row 15 (collapse)', ()=> {
assert.equal(22, game.rubble.length);
game.collapseRow(15);
assert.equal(2, game.rubble.length, 'the full row has been deleted');
assert.ok(_.some(game.rubble, point => point.row === 15 && point.col === 1), 'a point from the 2nd row has moved down');
assert.ok(_.some(game.rubble, point => point.row === 15 && point.col === 2), 'the other point from the 2nd row has moved down');
});
示例2: PostProcess
PostProcess(idea: IIdeaEntity, user: ILoggedOnUser) : IIdea {
var extendedIdea = idea as IIdea;
extendedIdea.liked = _.some(idea.likedList, item => item.id === user.id);
extendedIdea.joined = _.some(idea.joinedList, item => item.id === user.id);
extendedIdea.likeCount = idea.likedList.length;
extendedIdea.teamCount = idea.joinedList.length;
return helpers.ReplacePropertyValuesOf(idea, null, "");
}
示例3: setTimeout
setTimeout(function () {
//check if there is something to validate -> check required data for validation
var namesAreValid = data.Deputy1 !== undefined && data.Deputy1.FirstName !== undefined && data.Deputy1.LastName !== undefined;
var datesAreValid = _.isDate(data.Duration.From) && _.isDate(data.Duration.To);
if (!namesAreValid || !datesAreValid) {
//nothing to validate
deferred.resolve(true);
return;
}
//fetch items form somewhere - eg. db
var items =
[
{ "approvedDays": [moment(), moment().add('days', 1).startOf('days')], "fullName": "John Smith" },
{ "approvedDays": [moment().add('days', 1).startOf('days'), moment().add('days', 2).startOf('days')], "fullName": "Paul Neuman" },
];
//find out range
var durationRange = moment().range(data.Duration.From, data.Duration.To);
//validation
var hasSomeConflicts = _.some(items, function (item) {
return (item.fullName == (data.Deputy1.FirstName + " " + data.Deputy1.LastName) &&
_.some(item.approvedDays, function (approvedDay) {
return durationRange.contains(approvedDay.startOf('days'));
}));
});
deferred.resolve(!hasSomeConflicts);
}, 1000);
示例4: async
watcher.on(actions.updatePreferences, async (store, action) => {
// FIXME: multiwindow
const prefs = action.payload;
if (some(watchedPreferences, k => prefs.hasOwnProperty(k))) {
const currentTabId = store.getState().windows["root"].navigation.tab;
queueFetch(store, "root", currentTabId, FetchReason.ParamsChanged);
}
});
示例5: function
loadUrl: function (fragment) {
// If the root doesn't match, no routes can match either.
if (!this.matchRoot()) return false;
fragment = this.fragment = this.getFragment(fragment);
return _.some(this.handlers, function (handler) {
if (handler.route.test(fragment)) {
handler.callback(fragment);
return true;
}
});
},
示例6: done
response.on('end', () => {
var orgs : any[] = JSON.parse(body);
if (adminRepository.IsUserAdmin(profile.username)){
return done(null, profile);
}
if (_.some(orgs, (org) => { return org.id === organization.Id})){
return done(null, profile);
} else {
return done(null, false);
}
});
示例7:
graphics.lodTypes.forEach((lodType) => {
if (!_.some(lodTypeMenuItems, (item) => item.lodType === lodType)) {
lodTypeMenuItems.push(this.createLodTypeMenuItem(lodType, id));
}
});
示例8:
let embeded = _.find(result.embeded, (e: any) =>
_.some(statement.context.contextActivities.parent, (parent: any) => parent.id === e.objectId)
示例9:
data.Items.forEach((item: IIdeaEntity) => {
if (_.some(item.joinedList, i => i.id === user.id)) {
items.push(item);
}
});
示例10:
vm.shouldDrawChart = () => {
vm.reviewData = vm.getReviewData();
return vm.reviewData.length > 0 && _.some(vm.reviewData, (item) => item > 0);
};