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

@ts-common/iterator

Package Overview
Dependencies
Maintainers
1
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.0.31 to 0.0.32

3

index.d.ts

@@ -27,4 +27,5 @@ import { Tuple2 } from "@ts-common/tuple";

export declare const zip: <T>(...inputs: Iterable<T>[]) => Iterable<ReadonlyArray<T>>;
export declare const arrayEqual: <T>(a: ReadonlyArray<T> | undefined, b: ReadonlyArray<T> | undefined, e: (ai: T, bi: T) => boolean) => boolean;
export declare const isStrictEqual: (a: unknown, b: unknown) => boolean;
export declare const isEqual: <A, B>(a: Iterable<A>, b: Iterable<B>, e?: (ai: A, bi: B) => boolean) => boolean;
export declare const isArray: <T, U>(v: U | ReadonlyArray<T>) => v is ReadonlyArray<T>;
export declare const toArray: <T>(i: Iterable<T>) => ReadonlyArray<T>;

@@ -117,27 +117,34 @@ "use strict";

};
exports.arrayEqual = (a, b, e) => {
/* tslint:disable-next-line:no-if-statement */
if (a === b) {
// TypeScript gives an error in case if type of a and type of b are different
exports.isStrictEqual = (a, b) => a === b;
exports.isEqual = (a, b, e = exports.isStrictEqual) => {
// tslint:disable-next-line:no-if-statement
if (exports.isStrictEqual(a, b)) {
return true;
}
/* tslint:disable-next-line:no-if-statement */
if (a === undefined || b === undefined) {
return false;
}
const al = a.length;
const bl = b.length;
/* tslint:disable-next-line:no-if-statement */
if (al !== bl) {
return false;
}
/* tslint:disable-next-line:no-loop-statement */
for (let i = 0; i < al; ++i) {
/* tslint:disable-next-line:no-if-statement */
if (!e(a[i], b[i])) {
const ai = a[Symbol.iterator]();
const bi = b[Symbol.iterator]();
// tslint:disable-next-line:no-loop-statement
while (true) {
const av = ai.next();
const bv = bi.next();
// tslint:disable-next-line:no-if-statement
if (av.done || bv.done) {
return av.done === bv.done;
}
// tslint:disable-next-line:no-if-statement
if (!e(av.value, bv.value)) {
return false;
}
}
return true;
};
/*
export const arrayEqual = <T>(
a: ReadonlyArray<T>|undefined,
b: ReadonlyArray<T>|undefined,
e: (ai: T, bi: T) => boolean = isStrictEqual,
): boolean =>
a === undefined || b === undefined ? a === b : isEqual(a, b, e)
*/
exports.isArray = (v) => v instanceof Array;
exports.toArray = Array.from;
{
"name": "@ts-common/iterator",
"version": "0.0.31",
"version": "0.0.32",
"description": "Iterator library for JavaScript and TypeScript",

@@ -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