New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

iteragain

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iteragain - npm Package Compare versions

Comparing version 0.10.0 to 0.11.0

11

ExtendedIterator.d.ts

@@ -6,3 +6,3 @@ import { IteratorOrIterable, FlattenDeep, FlattenDepth1, FlattenDepth2, FlattenDepth3, FlattenDepth4, FlattenDepth5, Tuple } from './types';

/** Returns a `{ value, done }` object that adheres to the Iterator interface. */
next(): IteratorResult<T, any>;
next(): IteratorResult<T>;
/** Implements this as an Iterable so it's allowed to be used with "for of" loops. */

@@ -68,5 +68,2 @@ [Symbol.iterator](): IterableIterator<T>;

pairwise(): ExtendedIterator<[T, T]>;
/** Peek ahead of where the current iteration is. */
peek(): T | undefined;
peek<N extends number>(ahead: N): Tuple<T | undefined, N>;
/**

@@ -77,2 +74,8 @@ * Take the first `n` elements from this iterator.

take(n: number): ExtendedIterator<T>;
/** Peek ahead of where the current iteration is. This doesn't consume any values of the iterator. */
peek(): T | undefined;
peek<N extends number>(ahead: N): Tuple<T, N>;
/** Yield any number of values from this iterator. */
yield(): T | undefined;
yield<N extends number>(numOfValues: N): Tuple<T, N>;
/** Iterates and collects all values into an Array. This essentially invokes this iterator to start iterating. */

@@ -79,0 +82,0 @@ toArray(): T[];

@@ -103,10 +103,2 @@ "use strict";

}
peek(ahead) {
const values = [];
do
values.push(this.iterator.next().value);
while (--ahead > 0);
this.iterator = new ConcatIterator_1.default([(0, toIterator_1.default)(values), this.iterator]);
return !isNaN(ahead) ? values : values[0];
}
/**

@@ -119,2 +111,18 @@ * Take the first `n` elements from this iterator.

}
peek(ahead) {
const values = this.yield(ahead);
const valuesAsArray = Array.isArray(values) ? values : [values];
if (values && valuesAsArray.length)
this.iterator = new ConcatIterator_1.default([(0, toIterator_1.default)(valuesAsArray), this.iterator]);
return values;
}
yield(numOfValues) {
if (!numOfValues)
return this.iterator.next().value;
const values = [];
let next;
while (numOfValues-- > 0 && !(next = this.iterator.next()).done)
values.push(next.value);
return values;
}
/** Iterates and collects all values into an Array. This essentially invokes this iterator to start iterating. */

@@ -121,0 +129,0 @@ toArray() {

{
"name": "iteragain",
"version": "0.10.0",
"version": "0.11.0",
"description": "Javascript ES6 Iterable/Iterator utilities.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc