当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript underscore.some函数代码示例

本文整理汇总了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');
 });
开发者ID:kristianmandrup,项目名称:tetris,代码行数:7,代码来源:modelsTests.ts

示例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, "");
    }
开发者ID:hakant,项目名称:HackathonPlannerAPI,代码行数:10,代码来源:IdeaPrePostProcessor.ts

示例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);
开发者ID:rsamec,项目名称:business-rules,代码行数:30,代码来源:FakeVacationDeputyService.ts

示例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);
   }
 });
开发者ID:HorrerGames,项目名称:itch,代码行数:8,代码来源:fetchers.ts

示例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;
     }
   });
 },
开发者ID:Volicon,项目名称:NestedTypes,代码行数:11,代码来源:backbone.ts

示例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);
                            }
                        });
开发者ID:hakant,项目名称:HackathonPlannerAPI,代码行数:12,代码来源:GitHubAuthSetup.ts

示例7:

 graphics.lodTypes.forEach((lodType) => {
   if (!_.some(lodTypeMenuItems, (item) => item.lodType === lodType)) {
     lodTypeMenuItems.push(this.createLodTypeMenuItem(lodType, id));
   }
 });
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:5,代码来源:PlotLegend.ts

示例8:

 let embeded = _.find(result.embeded, (e: any) =>
   _.some(statement.context.contextActivities.parent, (parent: any) => parent.id === e.objectId)
开发者ID:easygenerator,项目名称:lrs,代码行数:2,代码来源:resultsUpdater.ts

示例9:

 data.Items.forEach((item: IIdeaEntity) => {
     if (_.some(item.joinedList, i => i.id === user.id)) {
         items.push(item);
     }
 });
开发者ID:hakant,项目名称:HackathonPlannerAPI,代码行数:5,代码来源:IdeaRepository.ts

示例10:

  vm.shouldDrawChart = () => {
    vm.reviewData = vm.getReviewData();

    return vm.reviewData.length > 0 && _.some(vm.reviewData, (item) => item > 0);
  };
开发者ID:bhollis,项目名称:DIM,代码行数:5,代码来源:item-review.component.ts


注:本文中的underscore.some函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。