123456789101112131415161718 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.permutations = void 0;
- function* permutations(arr, m = []) {
- if (arr.length === 0) {
- // @ts-ignore:
- yield m;
- }
- else {
- for (let i = 0; i < arr.length; i++) {
- let curr = arr.slice();
- let next = curr.splice(i, 1);
- yield* permutations(curr.slice(), m.concat(next));
- }
- }
- }
- exports.permutations = permutations;
- //# sourceMappingURL=permutations.js.map
|