當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。