Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gensequence

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gensequence - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

.nyc_output/be91998ff1fad5a1471338942636a82c.json

7

CHANGELOG.md
# Release Notes
## latest
* fix a function signature issue surfaced by typescript 2.4.2
## 2.0.1
* minor update to README.md.
* added test showing how it is not possible to reuse some iterators.
## 2.0.0

@@ -4,0 +11,0 @@ * sequences are now reusable as long as the original iterator is reusable.

4

lib/src/GenSequence.d.ts

@@ -16,4 +16,4 @@ export declare type Maybe<T> = T | undefined;

map<U>(fnMap: (t: T) => U): Sequence<U>;
scan(fnReduce: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): Sequence<T>;
scan<U>(fnReduce: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): Sequence<U>;
scan(fnReduce: (previousValue: T, currentValue: T, currentIndex: number) => T, initialValue?: T): Sequence<T>;
scan<U>(fnReduce: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): Sequence<U>;
all(fnFilter: (t: T) => boolean): boolean;

@@ -20,0 +20,0 @@ any(fnFilter: (t: T) => boolean): boolean;

{
"name": "gensequence",
"version": "2.0.0",
"version": "2.1.0",
"description": "Small library to simplify working with Generators and Iterators in Javascript / Typescript",

@@ -10,11 +10,11 @@ "main": "lib/index.js",

"@types/chai": "^3.4.34",
"@types/mocha": "^2.2.39",
"@types/mocha": "^2.2.41",
"@types/node": "^7.0.5",
"chai": "^3.5.0",
"coveralls": "^2.11.16",
"mocha": "^3.2.0",
"nyc": "^10.1.2",
"rimraf": "^2.5.4",
"ts-node": "^2.1.0",
"typescript": "^2.3.2"
"coveralls": "^2.13.1",
"mocha": "^3.4.2",
"nyc": "^11.0.3",
"rimraf": "^2.6.1",
"ts-node": "^3.3.0",
"typescript": "^2.4.2"
},

@@ -21,0 +21,0 @@ "scripts": {

@@ -14,3 +14,3 @@ # GenSequence

GenSequence is useful for cases where you might not want an array of all possible values.
GenSequence deals effeciently with large sequences because only one element at a time is evaluated.
GenSequence deals efficiently with large sequences because only one element at a time is evaluated.
Intermediate arrays are not created, saving memory and cpu cycles.

@@ -57,3 +57,3 @@

// Wrapper the Iterator result from calling the generator.
return genSequence(fib());
return genSequence(fib);
}

@@ -114,3 +114,3 @@

## Reference
- `genSequence(Iterable|Array)` -- generate a new Iterable from an Iterable or Array with the following functions.
- `genSequence(Iterable|Array|()=>Iterable)` -- generate a new Iterable from an Iterable, Array or function with the following functions.

@@ -117,0 +117,0 @@ ### Filters

@@ -526,2 +526,20 @@ import { genSequence, sequenceFromObject, sequenceFromRegExpMatch } from './GenSequence';

});
});
it('demonstrate that it is not possible to re-use iterators', () => {
const iter = fib();
const seq = genSequence(iter);
const fib5 = seq.skip(5).first();
const fib5b = seq.skip(5).first();
expect(fib5).to.be.equal(8);
// Try reusing the iterator.
expect(fib5b).to.be.undefined;
});
});
function* fib() {
let [a, b] = [0, 1];
while (true) {
yield b;
[a, b] = [b, a + b];
}
}

@@ -25,4 +25,4 @@

map<U>(fnMap: (t: T) => U): Sequence<U>;
scan(fnReduce: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): Sequence<T>;
scan<U>(fnReduce: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): Sequence<U>;
scan(fnReduce: (previousValue: T, currentValue: T, currentIndex: number) => T, initialValue?: T): Sequence<T>;
scan<U>(fnReduce: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): Sequence<U>;

@@ -29,0 +29,0 @@ //// Reducers

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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