@ts-common/iterator
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -27,3 +27,3 @@ export interface IteratorResult<T> { | ||
readonly last: () => T | undefined; | ||
readonly some: (func: (v: T, i: number) => boolean) => boolean; | ||
readonly some: (func?: (v: T, i: number) => boolean) => boolean; | ||
readonly every: (func: (v: T, i: number) => boolean) => boolean; | ||
@@ -60,3 +60,3 @@ readonly zip: (...inputs: readonly (Iterable<T> | undefined)[]) => IterableEx<readonly T[]>; | ||
export declare const last: <T>(input: Iterable<T> | undefined) => T | undefined; | ||
export declare const some: <T>(input: Iterable<T> | undefined, func: (v: T, i: number) => boolean) => boolean; | ||
export declare const some: <T>(input: Iterable<T> | undefined, func?: (v: T, i: number) => boolean) => boolean; | ||
export declare const every: <T>(input: Iterable<T> | undefined, func: (v: T, i: number) => boolean) => boolean; | ||
@@ -63,0 +63,0 @@ export declare const forEach: <T>(input: Iterable<T> | undefined, func: (v: T, i: number) => void) => void; |
@@ -119,3 +119,3 @@ "use strict"; | ||
exports.last = (input) => exports.reduce(input, (_, v) => v); | ||
exports.some = (input, func) => exports.findEntry(input, func) !== undefined; | ||
exports.some = (input, func = () => true) => exports.findEntry(input, func) !== undefined; | ||
exports.every = (input, func) => !exports.some(input, (v, i) => !func(v, i)); | ||
@@ -122,0 +122,0 @@ exports.forEach = (input, func) => |
{ | ||
"name": "@ts-common/iterator", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Iterator library for JavaScript and TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -30,3 +30,3 @@ export interface IteratorResult<T> { | ||
readonly last: () => T|undefined | ||
readonly some: (func: (v: T, i: number) => boolean) => boolean | ||
readonly some: (func?: (v: T, i: number) => boolean) => boolean | ||
readonly every: (func: (v: T, i: number) => boolean) => boolean | ||
@@ -65,3 +65,3 @@ readonly zip: (...inputs: readonly (Iterable<T>|undefined)[]) => IterableEx<readonly T[]> | ||
public reverse() { return reverse(this) } | ||
public some(func: (v: T, i: number) => boolean) { return some(this, func) } | ||
public some(func?: (v: T, i: number) => boolean) { return some(this, func) } | ||
public take(n?: number) { return take(this, n) } | ||
@@ -233,3 +233,3 @@ public takeWhile(func: (v: T, i: number) => boolean) { return takeWhile(this, func) } | ||
input: Iterable<T>|undefined, | ||
func: (v: T, i: number) => boolean, | ||
func: (v: T, i: number) => boolean = () => true, | ||
): boolean => | ||
@@ -236,0 +236,0 @@ findEntry(input, func) !== undefined |
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
53890