Skip to content

Instantly share code, notes, and snippets.

View helmutschneider's full-sized avatar

Johan Björk helmutschneider

  • Impossible Solution
  • Sweden
View GitHub Profile
import * as ts from 'typescript'
import { Rules, RuleWalker, RuleFailure } from 'tslint'
function find<T>(collection: T[], predicate: (it: T) => boolean): T | null {
for (const item of collection) {
if (predicate(item)) {
return item
}
}
return null