itertools
Advanced tools
Comparing version 2.2.4 to 2.2.5
@@ -299,2 +299,7 @@ type Predicate<T> = (value: T) => boolean; | ||
/** | ||
* Returns an iterator that produces values over and over again. Runs | ||
* indefinitely unless the times argument is specified. | ||
*/ | ||
declare function repeat<T>(thing: T, times?: number): IterableIterator<T>; | ||
/** | ||
* Returns an iterator that produces elements from the iterable as long as the | ||
@@ -455,2 +460,2 @@ * predicate is true. | ||
export { type Predicate, type Primitive, all, any, chain, chunked, compact, compactObject, compress, contains, count, cycle, dropwhile, enumerate, every, filter, find, first, flatmap, flatten, groupby, heads, icompact, icompress, ifilter, imap, islice, itake, iter, izip, izip2, izip3, izipLongest, izipMany, map, max, min, pairwise, partition, permutations, range, reduce, roundrobin, some, sorted, sum, take, takewhile, uniqueEverseen, uniqueJustseen, zip, zip3, zipLongest, zipMany }; | ||
export { type Predicate, type Primitive, all, any, chain, chunked, compact, compactObject, compress, contains, count, cycle, dropwhile, enumerate, every, filter, find, first, flatmap, flatten, groupby, heads, icompact, icompress, ifilter, imap, islice, itake, iter, izip, izip2, izip3, izipLongest, izipMany, map, max, min, pairwise, partition, permutations, range, reduce, repeat, roundrobin, some, sorted, sum, take, takewhile, uniqueEverseen, uniqueJustseen, zip, zip3, zipLongest, zipMany }; |
@@ -360,2 +360,13 @@ // src/utils.ts | ||
} | ||
function* repeat(thing, times) { | ||
if (times === void 0) { | ||
for (; ; ) { | ||
yield thing; | ||
} | ||
} else { | ||
for (const _ of range(times)) { | ||
yield thing; | ||
} | ||
} | ||
} | ||
function* takewhile(iterable, predicate) { | ||
@@ -563,2 +574,3 @@ const it = iter(iterable); | ||
reduce, | ||
repeat, | ||
roundrobin, | ||
@@ -565,0 +577,0 @@ some, |
{ | ||
"name": "itertools", | ||
"version": "2.2.4", | ||
"version": "2.2.5", | ||
"description": "A JavaScript port of Python's awesome itertools standard library", | ||
@@ -52,9 +52,9 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@arethetypeswrong/cli": "^0.13.10", | ||
"@arethetypeswrong/cli": "^0.15.0", | ||
"@release-it/keep-a-changelog": "^5.0.0", | ||
"@typescript-eslint/eslint-plugin": "^7.0.2", | ||
"@typescript-eslint/parser": "^7.0.2", | ||
"@vitest/coverage-istanbul": "^1.3.0", | ||
"eslint": "^8.56.0", | ||
"fast-check": "^3.15.1", | ||
"@vitest/coverage-istanbul": "^1.3.1", | ||
"eslint": "^8.57.0", | ||
"fast-check": "^3.16.0", | ||
"prettier": "^3.2.5", | ||
@@ -66,3 +66,3 @@ "publint": "^0.2.7", | ||
"vite-tsconfig-paths": "^4.3.1", | ||
"vitest": "^1.3.0" | ||
"vitest": "^1.3.1" | ||
}, | ||
@@ -69,0 +69,0 @@ "githubUrl": "https://github.com/nvie/itertools", |
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
189529
1573