Http Kernel!
This commit is contained in:
@@ -205,6 +205,17 @@ class Collection<T> {
|
||||
return new Collection(this._items.filter(func))
|
||||
}
|
||||
|
||||
find<T2>(func: KeyFunction<T, T2>): number | undefined {
|
||||
let found_index: number | undefined = undefined
|
||||
this._items.some((item, index) => {
|
||||
if ( func(item, index) ) {
|
||||
found_index = index
|
||||
return true
|
||||
}
|
||||
})
|
||||
return found_index
|
||||
}
|
||||
|
||||
when<T2>(bool: boolean, then: CollectionFunction<T, T2>): Collection<T> {
|
||||
if ( bool ) then(this)
|
||||
return this
|
||||
|
||||
Reference in New Issue
Block a user