當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript lodash.some函數代碼示例

本文整理匯總了TypeScript中lodash.some函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript some函數的具體用法?TypeScript some怎麽用?TypeScript some使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了some函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

 .filter(function(oa) {
     return _.some(oa.vuosiluokkakokonaisuudet, function(oavkl: any) {
         return _.parseInt(oavkl._vuosiluokkaKokonaisuus) === vkl.id;
     });
 })
開發者ID:Opetushallitus,項目名稱:eperusteet,代碼行數:5,代碼來源:perusopetus.ts

示例2: occupied

 get occupied(): boolean {
     return _.some(this.items, it => it.occupied);
 }
開發者ID:Gitjerryzhong,項目名稱:bell-tm-static,代碼行數:3,代碼來源:form.model.ts

示例3: function

 $scope.filterRyhma = function(ryhma) {
     return _.some(ryhma, $scope.filterJasen);
 };
開發者ID:Opetushallitus,項目名稱:eperusteet,代碼行數:3,代碼來源:sisalto.ts

示例4: function

 $scope.$watch('$ctrl.user', function(user) {
   if (user && user.id) {
     ctrl.doesUserStar = some(ctrl.stars, {'id': user.id});
   }
 });
開發者ID:carolinagc,項目名稱:paperhive-frontend,代碼行數:5,代碼來源:star-button.ts

示例5:

 return _.filter(meetings, meeting =>
     _.some(areaDistrictCheckModel, key => key.Truthy && key.Area === meeting.Area && key.District === meeting.District));
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:2,代碼來源:district.filter.ts

示例6: it

 it('should have 2 items in the "application" cache when we remove "foo" by application name', () => {
   RecentHistoryService.removeByAppName('foo');
   const items = RecentHistoryService.getItems('applications');
   expect(items.length).toBe(2);
   expect(some(items, { params: { application: 'foo' } })).toBeFalsy();
 });
開發者ID:emjburns,項目名稱:deck,代碼行數:6,代碼來源:recentHistory.service.spec.ts

示例7:

      );

      if (actualDistance > weaponStack.item.range) {
        return {
          isValid: false,
          error: `${targetPlayer.name} is out of ${weaponStack.item.name}'s attack range!`
        };
      }

      // check that gun shot is in a straight line and unobstructed
      if (targetPlayer.character.row === actor.row || targetPlayer.character.col === actor.col) {
        const cellsInBetween = Cell.getPositionsBetween(
          targetPlayer.character, actor
        ).map(pos => Map.getCell(game.map, pos));

        if (_.some(cellsInBetween, cell => Cell.isBarrier(cell))) {
          return {
            isValid: false,
            error: `Your shot is obstructed by a barrier!`
          };
        } else {
          // ok
        }
      } else {
        return {
          isValid: false,
          error: `You can only shoot in straight lines!`
        };
      }

      // now check that if the player is attacking with a gun, that they have the bullets required
開發者ID:zthomae,項目名稱:xanadu,代碼行數:31,代碼來源:actions.ts

示例8: isFocused

 const isFocusedSuite = (suite) => isFocused(suite) || some(suite, isFocused);
開發者ID:JamieMason,項目名稱:karma-benchmark,代碼行數:1,代碼來源:process-benchmarks.ts

示例9: onFilterInterests

 onFilterInterests(data: Person, searchValue: any): boolean {
   return _.some(data.interests, {id: Number(searchValue)});
 }
開發者ID:raketasoft,項目名稱:ng2-grid,代碼行數:3,代碼來源:demo.component.ts

示例10: if

        if (fileExts.indexOf(path.extname(file)) > -1) {
          state.files.push(file)
        }
      } else if (stat.isDirectory()) {
        state.dirs.push(file)
      } else {
        console.error(`unknown file ${file}`)
      }
      cb(null, state)
    })
  },
  readDirectory(dir: string, cb: {(err: Error | null, dirState: DirState | null)}) {
    fs.readdir(dir, (err, files) => {
      if (err) return cb(err, null)
      files = files.filter((f) => !noProcessRegex.test(f)).map((f) => path.join(dir, f))
      const dirFiles: DirState = {baseDir: dir, files: [], dirs: []}
      async.reduce(files, dirFiles, genUtil.seperateDirFiles.bind(genUtil, validExts), (err, state) => {
        if (err) return cb(err, null)
        state.files = state.files.sort()
        state.dirs = state.dirs.sort()
        cb(null, state)
      })
    })
  },
  matchesOne(file: string, regexps: RegExp[]): boolean {
    return _.some(regexps, (r) => r.test(file))
  }
}

export { genUtil }
開發者ID:instructure,項目名稱:ftl-engine,代碼行數:30,代碼來源:util.ts


注:本文中的lodash.some函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。