@nestia/e2e
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -15,2 +15,3 @@ /** | ||
function flat<T>(matrix: T[][]): T[]; | ||
function subsets<T>(array: T[]): T[][]; | ||
} |
@@ -216,3 +216,20 @@ "use strict"; | ||
ArrayUtil.flat = flat; | ||
function subsets(array) { | ||
var check = new Array(array.length).fill(false); | ||
var output = []; | ||
var dfs = function (depth) { | ||
if (depth === check.length) | ||
output.push(array.filter(function (_v, idx) { return check[idx]; })); | ||
else { | ||
check[depth] = true; | ||
dfs(depth + 1); | ||
check[depth] = false; | ||
dfs(depth + 1); | ||
} | ||
}; | ||
dfs(0); | ||
return output; | ||
} | ||
ArrayUtil.subsets = subsets; | ||
})(ArrayUtil = exports.ArrayUtil || (exports.ArrayUtil = {})); | ||
//# sourceMappingURL=ArrayUtil.js.map |
{ | ||
"name": "@nestia/e2e", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "E2E test utilify functions", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -87,2 +87,21 @@ /** | ||
} | ||
export function subsets<T>(array: T[]): T[][] { | ||
const check: boolean[] = new Array(array.length).fill(false); | ||
const output: T[][] = []; | ||
const dfs = (depth: number) => { | ||
if (depth === check.length) | ||
output.push(array.filter((_v, idx) => check[idx])); | ||
else { | ||
check[depth] = true; | ||
dfs(depth + 1); | ||
check[depth] = false; | ||
dfs(depth + 1); | ||
} | ||
}; | ||
dfs(0); | ||
return output; | ||
} | ||
} |
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
122952
2418