本文整理汇总了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;
});
})
示例2: occupied
get occupied(): boolean {
return _.some(this.items, it => it.occupied);
}
示例3: function
$scope.filterRyhma = function(ryhma) {
return _.some(ryhma, $scope.filterJasen);
};
示例4: function
$scope.$watch('$ctrl.user', function(user) {
if (user && user.id) {
ctrl.doesUserStar = some(ctrl.stars, {'id': user.id});
}
});
示例5:
return _.filter(meetings, meeting =>
_.some(areaDistrictCheckModel, key => key.Truthy && key.Area === meeting.Area && key.District === meeting.District));
示例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();
});
示例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
示例8: isFocused
const isFocusedSuite = (suite) => isFocused(suite) || some(suite, isFocused);
示例9: onFilterInterests
onFilterInterests(data: Person, searchValue: any): boolean {
return _.some(data.interests, {id: Number(searchValue)});
}
示例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 }