combine-utils
Advanced tools
Comparing version 1.0.4 to 2.0.0
@@ -11,5 +11,5 @@ "use strict"; | ||
var getIdentifiersFromItem = function (item) { return item.identifers; }; | ||
var combinations = createCombinations_1.createCombinations(collectionWithIdentifiers, getIdentifiersFromItem, options); | ||
var combinations = (0, createCombinations_1.createCombinations)(collectionWithIdentifiers, getIdentifiersFromItem, options); | ||
return combinations.map(function (combination) { return combination.map(function (item) { return item.value; }); }); | ||
} | ||
exports.createCombinations = createCombinations; |
@@ -12,7 +12,7 @@ "use strict"; | ||
var numberOfCalls = { calls: 0 }; | ||
var allCombinations = createCombinations_1.createCombinations(collectionWithIdentifiers, { | ||
var allCombinations = (0, createCombinations_1.createCombinations)(collectionWithIdentifiers, { | ||
minimumLength: 1, | ||
storeNumberOfCallsIn: numberOfCalls | ||
}); | ||
var sets = createCompleteCombinations_1.createCompleteCombinations(allCombinations, function (item) { return item.map(function (i) { return i.index; }); }, options); | ||
var sets = (0, createCompleteCombinations_1.createCompleteCombinations)(allCombinations, function (item) { return item.map(function (i) { return i.index; }); }, options); | ||
if (options && options.storeNumberOfCallsIn) { | ||
@@ -19,0 +19,0 @@ options.storeNumberOfCallsIn.calls += numberOfCalls.calls; |
@@ -13,6 +13,10 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -42,3 +46,3 @@ exports.__esModule = true; | ||
// Step 3: Create a new combination form the current one and add the first item. | ||
var newCombination = __spreadArray(__spreadArray([], currentCombination), [firstItem]); | ||
var newCombination = __spreadArray(__spreadArray([], currentCombination, true), [firstItem], false); | ||
var newCombinationWithLengthRestrictions = (maximumLength && newCombination.length > maximumLength) || | ||
@@ -53,3 +57,3 @@ (minimumLength && newCombination.length < minimumLength) | ||
// We can return since we don't have to search for more items. | ||
return __spreadArray(__spreadArray([], newCombinationWithLengthRestrictions), restCombinations); | ||
return __spreadArray(__spreadArray([], newCombinationWithLengthRestrictions, true), restCombinations, true); | ||
} | ||
@@ -67,3 +71,3 @@ // Step 6: Filter all combinations from the restItems that contain the identifiers from the first item. | ||
: []; | ||
return __spreadArray(__spreadArray(__spreadArray([], incompleteCombination), internalCreate(restItemsWithoutCurrentCombinationAndFirstItem, allIdentifiers, getAllIdentifiersForCollection, newCombination, options)), restCombinations); | ||
return __spreadArray(__spreadArray(__spreadArray([], incompleteCombination, true), internalCreate(restItemsWithoutCurrentCombinationAndFirstItem, allIdentifiers, getAllIdentifiersForCollection, newCombination, options), true), restCombinations, true); | ||
} | ||
@@ -91,4 +95,4 @@ function create(collection, getIdentifiersFromItem, options) { | ||
: []; | ||
return __spreadArray(__spreadArray([], emptyCollection), internalCreate(collection, getAllIdentifiersForCollection(collection), getAllIdentifiersForCollection, [], options)); | ||
return __spreadArray(__spreadArray([], emptyCollection, true), internalCreate(collection, getAllIdentifiersForCollection(collection), getAllIdentifiersForCollection, [], options), true); | ||
} | ||
exports.create = create; |
@@ -17,4 +17,4 @@ "use strict"; | ||
function createCombinations(collection, getIdentifiersFromItem, options) { | ||
return create_1.create(collection, getIdentifiersFromItem, __assign(__assign({}, options), { includeIncompleteCombinations: true })); | ||
return (0, create_1.create)(collection, getIdentifiersFromItem, __assign(__assign({}, options), { includeIncompleteCombinations: true })); | ||
} | ||
exports.createCombinations = createCombinations; |
@@ -17,4 +17,4 @@ "use strict"; | ||
function createCompleteCombinations(collection, getIdentifiersFromItem, options) { | ||
return create_1.create(collection, getIdentifiersFromItem, __assign(__assign({}, options), { includeIncompleteCombinations: false })); | ||
return (0, create_1.create)(collection, getIdentifiersFromItem, __assign(__assign({}, options), { includeIncompleteCombinations: false })); | ||
} | ||
exports.createCompleteCombinations = createCompleteCombinations; |
{ | ||
"name": "combine-utils", | ||
"version": "1.0.4", | ||
"version": "2.0.0", | ||
"description": "Utility functions to help with combining items.", | ||
"main": "dist/lib/index.js", | ||
"engines": { | ||
"node": ">=12.20.0" | ||
}, | ||
"repository": "https://github.com/thomasheyenbrock/combine-utils.git", | ||
@@ -33,14 +36,14 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/core": "7.14.6", | ||
"@babel/preset-env": "7.14.7", | ||
"@babel/preset-typescript": "7.14.5", | ||
"@types/jest": "26.0.23", | ||
"@types/node": "15.12.4", | ||
"@babel/core": "7.16.0", | ||
"@babel/preset-env": "7.16.4", | ||
"@babel/preset-typescript": "7.16.0", | ||
"@types/jest": "27.0.2", | ||
"@types/node": "16.11.7", | ||
"commitlint": "12.1.4", | ||
"husky": "6.0.0", | ||
"jest": "27.0.5", | ||
"lint-staged": "11.0.0", | ||
"jest": "27.3.1", | ||
"lint-staged": "11.1.2", | ||
"opn-cli": "5.0.0", | ||
"pinst": "2.1.6", | ||
"prettier": "2.3.1", | ||
"prettier": "2.4.1", | ||
"rimraf": "3.0.2", | ||
@@ -51,4 +54,4 @@ "semantic-release": "17.4.4", | ||
"tslint-config-prettier": "1.18.0", | ||
"typescript": "4.3.4" | ||
"typescript": "4.4.4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20289
213