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.1.2 to 0.1.3

1

dist/index.d.ts

@@ -48,2 +48,3 @@ import { Tuple2 } from "@ts-common/tuple";

export declare const dropRight: <T>(i: ReadonlyArray<T> | undefined, n?: number) => Iterable<T>;
export declare const uniq: <T>(i: Iterable<T>, key?: (v: T) => unknown) => Iterable<T>;
//# sourceMappingURL=index.d.ts.map

@@ -154,2 +154,15 @@ "use strict";

exports.dropRight = (i, n = 1) => i === undefined ? [] : exports.take(i, i.length - n);
exports.uniq = (i, key = v => v) => exports.iterable(function* () {
const set = new Set();
// tslint:disable-next-line:no-loop-statement
for (const v of i) {
const k = key(v);
// tslint:disable-next-line:no-if-statement
if (!set.has(k)) {
// tslint:disable-next-line:no-expression-statement
set.add(k);
yield v;
}
}
});
//# sourceMappingURL=index.js.map

8

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

@@ -57,8 +57,8 @@ "main": "dist/index.js",

"tslint": "^5.12.1",
"tslint-immutable": "^5.1.0",
"typescript": "^3.2.2"
"tslint-immutable": "^5.1.2",
"typescript": "^3.3.1"
},
"dependencies": {
"@ts-common/tuple": "^0.0.5"
"@ts-common/tuple": "^0.0.6"
}
}

@@ -274,1 +274,16 @@ import { Tuple2, tuple2 } from "@ts-common/tuple"

i === undefined ? [] : take(i, i.length - n)
export const uniq = <T>(i: Iterable<T>, key: (v: T) => unknown = v => v): Iterable<T> =>
iterable(function *() {
const set = new Set<unknown>()
// tslint:disable-next-line:no-loop-statement
for (const v of i) {
const k = key(v)
// tslint:disable-next-line:no-if-statement
if (!set.has(k)) {
// tslint:disable-next-line:no-expression-statement
set.add(k)
yield v
}
}
})

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