@opencreek/ext
Advanced tools
Comparing version 1.6.0--canary.10.78cea1d40cc3fe776c9a1efbcde8139d5d8afb8c.0 to 1.6.0--canary.10.df9c11b87a72ac619a8f3544194f20cdce9c2c18.0
@@ -16,3 +16,3 @@ "use strict"; | ||
const keys = Object.keys(wrap); | ||
if (keys.length != 1) { | ||
if (keys.length !== 1) { | ||
throw Error("You must give extendPrototypeWithName an object with one key"); | ||
@@ -19,0 +19,0 @@ } |
{ | ||
"name": "@opencreek/ext", | ||
"version": "1.6.0--canary.10.78cea1d40cc3fe776c9a1efbcde8139d5d8afb8c.0", | ||
"version": "1.6.0--canary.10.df9c11b87a72ac619a8f3544194f20cdce9c2c18.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -12,6 +12,6 @@ import * as collections from "@opencreek/deno-std-collections" | ||
async function mapAsync<T, U>( | ||
this: Array<T>, | ||
f: (e: T, index: number, array: Array<T>) => Promise<U> | ||
this: Array<T>, | ||
f: (e: T, index: number, array: Array<T>) => Promise<U> | ||
): Promise<Array<U>> { | ||
return Promise.all(this.map(f)) | ||
return Promise.all(this.map(f)) | ||
} | ||
@@ -23,5 +23,5 @@ | ||
): Promise<Array<T>> { | ||
const includes = await this.mapAsync(f) | ||
const includes = await this.mapAsync(f) | ||
return this.filter((_, index) => includes[index]) | ||
return this.filter((_, index) => includes[index]) | ||
} | ||
@@ -94,3 +94,5 @@ | ||
dropWhile(predicate: (el: T) => boolean): T[] | ||
filterAsync(predicate: (el: T, index: number, array: Array<T>) => Promise<boolean>): Promise<Array<T>> | ||
filterAsync( | ||
predicate: (el: T, index: number, array: Array<T>) => Promise<boolean> | ||
): Promise<Array<T>> | ||
filterNotNullish(): Array<NonNullable<T>> | ||
@@ -105,3 +107,5 @@ findLast(predicate: (el: T) => boolean): T | undefined | ||
intersect(...arrays: (readonly T[])[]): T[] | ||
mapAsync<U>(transformer: (el: T, index: number, array: Array<T>) => Promise<U>): Promise<Array<U>> | ||
mapAsync<U>( | ||
transformer: (el: T, index: number, array: Array<T>) => Promise<U> | ||
): Promise<Array<U>> | ||
mapNotNullish<O>(transformer: (el: T) => O): NonNullable<O>[] | ||
@@ -157,3 +161,5 @@ maxBy(selector: (el: T) => string): T | undefined | ||
dropWhile(predicate: (el: T) => boolean): T[] | ||
filterAsync(predicate: (el: T, index: number, array: Array<T>) => Promise<boolean>): Promise<Array<T>> | ||
filterAsync( | ||
predicate: (el: T, index: number, array: Array<T>) => Promise<boolean> | ||
): Promise<Array<T>> | ||
filterNotNullish(): Array<NonNullable<T>> | ||
@@ -168,3 +174,5 @@ findLast(predicate: (el: T) => boolean): T | undefined | ||
intersect(...arrays: (readonly T[])[]): T[] | ||
mapAsync<U>(transformer: (el: T, index: number, array: Array<T>) => Promise<U>): Promise<Array<U>> | ||
mapAsync<U>( | ||
transformer: (el: T, index: number, array: Array<T>) => Promise<U> | ||
): Promise<Array<U>> | ||
mapNotNullish<O>(transformer: (el: T) => O): NonNullable<O>[] | ||
@@ -171,0 +179,0 @@ maxBy(selector: (el: T) => string): T | undefined |
@@ -16,12 +16,12 @@ /* eslint-disable @typescript-eslint/ban-types */ | ||
export function extendPrototypeWithName<T extends Record<string, Function>>( | ||
target: Function, | ||
wrap: T | ||
target: Function, | ||
wrap: T | ||
): void { | ||
const keys = Object.keys(wrap) | ||
if (keys.length != 1) { | ||
throw Error("You must give extendPrototypeWithName an object with one key") | ||
} | ||
const name = keys[0] | ||
const keys = Object.keys(wrap) | ||
if (keys.length !== 1) { | ||
throw Error("You must give extendPrototypeWithName an object with one key") | ||
} | ||
const name = keys[0] | ||
extendProtoype(target, wrap[name], name) | ||
extendProtoype(target, wrap[name], name) | ||
} | ||
@@ -28,0 +28,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49066
738