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

@wixc3/common

Package Overview
Dependencies
Maintainers
65
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/common - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

dist/cjs/arrays.d.ts

1

dist/cjs/index.d.ts

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

export * from './strings';
export * from './arrays';
export * from './numbers';

@@ -8,0 +9,0 @@ export * from './objects';

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

__exportStar(require("./strings"), exports);
__exportStar(require("./arrays"), exports);
__exportStar(require("./numbers"), exports);

@@ -24,0 +25,0 @@ __exportStar(require("./objects"), exports);

1

dist/cjs/objects.d.ts

@@ -41,3 +41,2 @@ import type { UnionToIntersection } from './types';

}, Key extends string>(obj: In): Promise<Out>;
export declare function getCartesianProductOfArrays<T>(arrays: T[][]): T[][];
export declare const newMacrotask: () => Promise<void>;

@@ -44,0 +43,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.remap = exports.getIn = exports.defaults = exports.reverseObject = exports.newMacrotask = exports.getCartesianProductOfArrays = exports.awaitRecord = exports.reportError = exports.isPlainObject = exports.mapKeys = exports.mapValues = exports.mapObject = exports.pick = exports.exclude = void 0;
exports.remap = exports.getIn = exports.defaults = exports.reverseObject = exports.newMacrotask = exports.awaitRecord = exports.reportError = exports.isPlainObject = exports.mapKeys = exports.mapValues = exports.mapObject = exports.pick = exports.exclude = void 0;
const promise_assist_1 = require("promise-assist");

@@ -79,21 +79,2 @@ const chain_1 = require("./chain");

exports.awaitRecord = awaitRecord;
function getCartesianProductOfArrays(arrays) {
if (arrays.length === 0) {
return [];
}
else if (arrays.length === 1) {
return arrays[0].map((elem) => [elem]);
}
else {
const otherCombinations = getCartesianProductOfArrays(arrays.slice(1));
const finalCombinations = [];
for (const elem of arrays[0]) {
for (const combo of otherCombinations) {
finalCombinations.push([elem, ...combo]);
}
}
return finalCombinations;
}
}
exports.getCartesianProductOfArrays = getCartesianProductOfArrays;
const newMacrotask = () => (0, promise_assist_1.sleep)(0);

@@ -100,0 +81,0 @@ exports.newMacrotask = newMacrotask;

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

export * from './strings';
export * from './arrays';
export * from './numbers';

@@ -8,0 +9,0 @@ export * from './objects';

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

export * from './strings';
export * from './arrays';
export * from './numbers';

@@ -8,0 +9,0 @@ export * from './objects';

@@ -41,3 +41,2 @@ import type { UnionToIntersection } from './types';

}, Key extends string>(obj: In): Promise<Out>;
export declare function getCartesianProductOfArrays<T>(arrays: T[][]): T[][];
export declare const newMacrotask: () => Promise<void>;

@@ -44,0 +43,0 @@ /**

@@ -68,20 +68,2 @@ import { sleep } from 'promise-assist';

}
export function getCartesianProductOfArrays(arrays) {
if (arrays.length === 0) {
return [];
}
else if (arrays.length === 1) {
return arrays[0].map((elem) => [elem]);
}
else {
const otherCombinations = getCartesianProductOfArrays(arrays.slice(1));
const finalCombinations = [];
for (const elem of arrays[0]) {
for (const combo of otherCombinations) {
finalCombinations.push([elem, ...combo]);
}
}
return finalCombinations;
}
}
export const newMacrotask = () => sleep(0);

@@ -88,0 +70,0 @@ /**

{
"name": "@wixc3/common",
"version": "4.0.0",
"version": "4.0.1",
"description": "Common utils, usable in all environments",

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

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

export * from './strings';
export * from './arrays';
export * from './numbers';

@@ -8,0 +9,0 @@ export * from './objects';

@@ -95,19 +95,2 @@ import { sleep } from 'promise-assist';

export function getCartesianProductOfArrays<T>(arrays: T[][]): T[][] {
if (arrays.length === 0) {
return [];
} else if (arrays.length === 1) {
return arrays[0]!.map((elem) => [elem]);
} else {
const otherCombinations = getCartesianProductOfArrays(arrays.slice(1));
const finalCombinations: T[][] = [];
for (const elem of arrays[0]!) {
for (const combo of otherCombinations) {
finalCombinations.push([elem, ...combo]);
}
}
return finalCombinations;
}
}
export const newMacrotask = () => sleep(0);

@@ -114,0 +97,0 @@

import { expect } from 'chai';
import { getCartesianProductOfArrays } from '..';
import { getCartesianProduct } from '..';

@@ -7,9 +7,9 @@ describe('getCartesianProductOfArrays', () => {

it('no arrays', () => {
expect(getCartesianProductOfArrays([])).to.deep.equal([]);
expect(getCartesianProduct([])).to.deep.equal([]);
});
it('one array', () => {
expect(getCartesianProductOfArrays([[1, 2, 3]])).to.deep.equal([[1], [2], [3]]);
expect(getCartesianProduct([[1, 2, 3]])).to.deep.equal([[1], [2], [3]]);
});
it('two arrays', () => {
const combos = getCartesianProductOfArrays([
const combos = getCartesianProduct([
[1, 2],

@@ -25,3 +25,3 @@ [3, 4],

it('three arrays', () => {
const combos = getCartesianProductOfArrays([
const combos = getCartesianProduct([
[1, 2],

@@ -28,0 +28,0 @@ [3, 4],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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