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

@ts-common/iterator

Package Overview
Dependencies
Maintainers
3
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-common/iterator - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

5

dist/index.d.ts

@@ -133,2 +133,6 @@ /**

readonly uniq: (key?: (v: T) => unknown) => IterableEx<T>;
/**
* Creates a new sequence of accamulated values.
*/
readonly scan: <A>(func: (a: A, b: T, i: number) => A, init: A) => IterableEx<A>;
};

@@ -155,2 +159,3 @@ export declare const iterable: <T>(createIterator: () => Iterator<T>) => IterableEx<T>;

export declare const repeat: <T>(v: T, count?: number | undefined) => IterableEx<T>;
export declare const scan: <T, A>(input: Iterable<T> | undefined, func: (a: A, b: T, i: number) => A, init: A) => IterableEx<A>;
export declare const fold: <T, A>(input: Iterable<T> | undefined, func: (a: A, b: T, i: number) => A, init: A) => A;

@@ -157,0 +162,0 @@ export declare const reduce: <T>(input: Iterable<T> | undefined, func: (a: T, b: T, i: number) => T) => T | undefined;

@@ -31,2 +31,3 @@ "use strict";

zip: property(exports.zip),
scan: property(exports.scan),
};

@@ -110,2 +111,12 @@ };

exports.repeat = (v, count) => exports.generate(() => v, count);
exports.scan = (input, func, init) => exports.iterable(function* () {
let result = init;
yield result;
/* tslint:disable-next-line:no-loop-statement */
for (const [index, value] of exports.entries(input)) {
/* tslint:disable-next-line:no-expression-statement */
result = func(result, value, index);
yield result;
}
});
exports.fold = (input, func, init) => {

@@ -112,0 +123,0 @@ let result = init;

2

package.json
{
"name": "@ts-common/iterator",
"version": "0.3.3",
"version": "0.3.4",
"description": "Iterator library for JavaScript and TypeScript",

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

@@ -136,2 +136,6 @@ /**

readonly uniq: (key?: (v: T) => unknown) => IterableEx<T>,
/**
* Creates a new sequence of accamulated values.
*/
readonly scan: <A>(func: (a: A, b: T, i: number) => A, init: A) => IterableEx<A>,
}

@@ -168,2 +172,3 @@

zip: property(zip),
scan: property(scan),
}

@@ -301,2 +306,18 @@ }

export const scan = <T, A>(
input: Iterable<T> | undefined,
func: (a: A, b: T, i: number) => A,
init: A,
): IterableEx<A> =>
iterable(function *() {
let result: A = init
yield result
/* tslint:disable-next-line:no-loop-statement */
for (const [index, value] of entries(input)) {
/* tslint:disable-next-line:no-expression-statement */
result = func(result, value, index)
yield result
}
})
export const fold = <T, A>(

@@ -303,0 +324,0 @@ input: Iterable<T> | undefined,

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