本文整理匯總了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);
};