custom-permutation 1.0.7 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,324 +1,210 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PermutationGeneratorForSet = void 0;
4
- var Utils_1 = require("./Utils");
5
- var PermutationGeneratorForSet = /** @class */ (function () {
6
- function PermutationGeneratorForSet(elementList, set, // set of index
7
- choicesByIndex, indexesOfSameElements, actualOrderOfElements, passFunction, randomizeChoices) {
4
+ class PermutationGeneratorForSet {
5
+ constructor(elementList, indexList, choicesByIndex, indexesOfSameElements, actualOrderOfElements, passFunction) {
8
6
  this.elementList = elementList;
9
- this.set = set;
7
+ this.indexList = indexList;
10
8
  this.choicesByIndex = choicesByIndex;
11
9
  this.indexesOfSameElements = indexesOfSameElements;
12
10
  this.actualOrderOfElements = actualOrderOfElements;
13
11
  this.passFunction = passFunction;
14
- this.randomizeChoices = randomizeChoices;
15
- this.choicesArraysInitial = []; // possible choices for each element for requested permutations
16
- this.choicesArrays = []; // possible choices for each element for requested permutations
17
- this.numOfEl = 0;
18
- this.currentIndsOfChoices = []; // indice array of current perm to compose
19
- this.currentElInd = 0; // indice of current elemet to add in perm list
20
- this.newPerm = []; // list for new permutation
21
- this.initialSet = []; // original set for new permutation
22
- this.listIndexesAfterArrangement = [];
23
- this.actualAndPrevIndexesInPermAfterSortedByChoicesLength = {};
24
- this.elIsUsedDict = {}; // keeps the usage status of each set index as key
25
- // Which defines the actual orders of these elements, used as timeSlot
26
- // default orders are sequental, but in usage, they can be seperate from each other
27
- this.actualOrderOfElements = this.actualOrderOfElements || Array(set.length).fill(1).map(function (el, i) { return i; });
28
- // indexesofsameelements is position of every element by default
29
- this.indexesOfSameElements = this.indexesOfSameElements || Array(set.length).fill(1).map(function (el, i) { return i; });
30
- if (!this.validateParameters(set, choicesByIndex)) {
12
+ this.choicesArraysInitial = [];
13
+ this.choicesArrays = [];
14
+ this.size = 0;
15
+ this.currentIndsOfChoices = [];
16
+ this.currentElInd = 0;
17
+ this.newPerm = [];
18
+ this.initialIndexList = [];
19
+ this.indexesAndChoicesCountsSortedByLength = [];
20
+ this.indexesAndChoicesCounts = [];
21
+ this.visitedDict = {};
22
+ this.actualOrderOfElements =
23
+ this.actualOrderOfElements ||
24
+ Array(indexList.length)
25
+ .fill(1)
26
+ .map((el, i) => i);
27
+ this.indexesOfSameElements =
28
+ this.indexesOfSameElements ||
29
+ Array(indexList.length)
30
+ .fill(1)
31
+ .map((el, i) => i);
32
+ if (!this.validateParameters(indexList, choicesByIndex)) {
31
33
  return;
32
34
  }
33
- this.initialSet = set;
34
- set = set.reduce(function (init, el, i) { return set.indexOf(el) == i ? init.concat(el) : init; }, []); // be sure for it to be set
35
- this.numOfEl = set.length;
35
+ indexList = Array.from(new Set(indexList));
36
+ this.initialIndexList = indexList;
37
+ this.size = indexList.length;
36
38
  this.initChoicesArray();
37
39
  this.reorderListAndChoicesAccordingToChoicesCount();
38
- this.initPrevIndexes();
39
- this.currentIndsOfChoices[this.numOfEl - 1] = -1; // make last element as to be next
40
+ this.currentIndsOfChoices[this.size - 1] = -1;
40
41
  this.init();
41
42
  }
42
- PermutationGeneratorForSet.prototype.initPrevIndexes = function () {
43
- var keys = Object.keys(this.indexesAndChoicesArrayLengthsSortedByLength);
44
- var _loop_1 = function (permInd) {
45
- var elIndInPerm = this_1.indexesAndChoicesArrayLengthsSortedByLength[permInd].index;
46
- var prevElIndInPerm = this_1.indexesAndChoicesArrayLengthsSortedByLength.findIndex(function (x) { return x.index == elIndInPerm - 1; });
47
- var nextElIndInPerm = this_1.indexesAndChoicesArrayLengthsSortedByLength.findIndex(function (x) { return x.index == elIndInPerm + 1; });
48
- this_1.actualAndPrevIndexesInPermAfterSortedByChoicesLength[permInd] = {
49
- actualIndex: elIndInPerm,
50
- indexOfPrevInPerm: prevElIndInPerm,
51
- indexOfNextInPerm: nextElIndInPerm
52
- };
53
- };
54
- var this_1 = this;
55
- for (var permInd = 0; permInd < keys.length; permInd++) {
56
- _loop_1(permInd);
57
- }
58
- };
59
- PermutationGeneratorForSet.prototype.isNewPermWithNewElementConsecutivelyDifferent = function (currentEl, elIndInChoices, elIndInPerm) {
60
- var _this = this;
61
- var newPerm = this.newPerm.slice();
62
- newPerm[elIndInPerm] = currentEl;
63
- var actualOrderedNewPerm = this.revertResultPermToInitialOrder(newPerm);
64
- if (this.passFunction) {
65
- var elArray_1 = [];
66
- actualOrderedNewPerm.forEach(function (elInd, i) { return elArray_1[i] = _this.elementList[elInd]; });
67
- var pass = this.passFunction(elArray_1.filter(function (x) { return x; })); // Remove undefineds, since some array elements are undefined when building
68
- return pass;
69
- }
70
- return true;
71
- };
72
- // Shouldn't be checked in this class, better to check in a high level, like custom permutation or listschuduler
73
- // Means previous actual element is not same with current one
74
- PermutationGeneratorForSet.prototype.isNewPermWithNewElementConsecutivelyDifferent_ = function (currentEl, elIndInChoices, elIndInPerm) {
75
- var _this = this;
76
- var newPerm = this.newPerm.slice();
43
+ isNewPermutationPassingFunction(currentEl, elIndInPerm) {
44
+ const newPerm = this.newPerm.slice();
77
45
  newPerm[elIndInPerm] = currentEl;
78
- var actualOrderedNewPerm = this.revertResultPermToInitialOrder(newPerm);
79
- // this block can be used upon need or comment
46
+ const actualOrderedNewPerm = this.revertResultPermToInitialOrder(newPerm);
80
47
  if (this.passFunction) {
81
- var elArray_2 = [];
82
- actualOrderedNewPerm.forEach(function (elInd, i) { return elArray_2[i] = _this.elementList[elInd]; });
83
- var pass = this.passFunction(elArray_2);
84
- return pass;
85
- }
86
- var actualOrderOfPrev = Number(this.actualOrderOfElements[0]);
87
- var prevEl = this.elementList[actualOrderOfPrev];
88
- var actualOrderOfCurr, currEl;
89
- for (var i = 1; i < actualOrderedNewPerm.length; i++) {
90
- actualOrderOfCurr = Number(this.actualOrderOfElements[i]);
91
- currEl = this.elementList[actualOrderedNewPerm[i]];
92
- if (currEl && prevEl && currEl != 0 && prevEl != 0 && Math.abs(actualOrderOfCurr - actualOrderOfPrev) == 1 && currEl == prevEl) {
93
- {
94
- return false;
95
- }
96
- }
97
- actualOrderOfPrev = actualOrderOfCurr;
98
- prevEl = currEl;
48
+ const elArray = [];
49
+ actualOrderedNewPerm.forEach((elInd, i) => (elArray[i] = this.elementList[elInd]));
50
+ const passed = this.passFunction(elArray.filter((x) => x !== undefined && x !== null)); // Remove nulls, since some array elements are undefined when building
51
+ return passed;
99
52
  }
100
53
  return true;
101
- };
102
- // Means previous actual element is not same with current one
103
- PermutationGeneratorForSet.prototype.isPreviousElementDifferentOrCanSkipThisFn = function (currentEl, elIndInChoices, elIndInPerm) {
104
- var prevElIndInPerm = this.actualAndPrevIndexesInPermAfterSortedByChoicesLength[elIndInPerm].indexOfPrevInPerm; // this.indexesAndChoicesArrayLengthsSortedByLength.indexOf(this.indexesAndChoicesArrayLengths.filter(x=>x.index == elIndInPerm-1)[0]);
105
- var nextElIndInPerm = this.actualAndPrevIndexesInPermAfterSortedByChoicesLength[elIndInPerm].indexOfNextInPerm; // this.indexesAndChoicesArrayLengthsSortedByLength.indexOf(this.indexesAndChoicesArrayLengths.filter(x=>x.index == elIndInPerm-1)[0]);
106
- elIndInPerm = this.indexesAndChoicesArrayLengthsSortedByLength[elIndInPerm].index;
107
- prevElIndInPerm = this.indexesAndChoicesArrayLengthsSortedByLength.indexOf(this.indexesAndChoicesArrayLengths.filter(function (x) { return x.index == elIndInPerm - 1; })[0]);
108
- if (elIndInPerm == 0 || !this.newPerm[prevElIndInPerm]) {
109
- return true; // if not set yet, return true
110
- }
111
- if (this.actualOrderOfElements[elIndInPerm] - this.actualOrderOfElements[prevElIndInPerm] != 1) {
112
- return true; // since this is not conseccutive, skip function
113
- }
114
- if (this.actualOrderOfElements[elIndInPerm] - this.actualOrderOfElements[prevElIndInPerm] == 1 &&
115
- (this.elementList[this.newPerm[elIndInPerm]] != this.elementList[this.newPerm[prevElIndInPerm]] &&
116
- this.indexesOfSameElements[this.newPerm[prevElIndInPerm]].indexOf(currentEl) == -1)) {
117
- return true; // they are consecutive and different from each other and also different from sameElementIndexes
118
- }
119
- if (this.elementList[this.newPerm[prevElIndInPerm]] == 0 || this.elementList[currentEl] == 0) {
120
- return true; // skip the zeros, since they can be consecutive
121
- }
122
- return false;
123
- };
54
+ }
124
55
  // Change choice arrays elements order to take low choices front to place them firstly
125
- PermutationGeneratorForSet.prototype.reorderListAndChoicesAccordingToChoicesCount = function () {
126
- var _this = this;
127
- this.indexesAndChoicesArrayLengths = [];
128
- this.choicesArrays.forEach((function (list, ind) { return _this.indexesAndChoicesArrayLengths.push({ index: ind, length: list.length }); }));
129
- // debugger
130
- this.indexesAndChoicesArrayLengthsSortedByLength = this.indexesAndChoicesArrayLengths.slice()
131
- .sort(function (el1, el2) { return el1.length < el2.length ? -1 : el1.length == el2.length && el1.index < el2.index ? -1 : 1; });
132
- var newChoicesArray = [];
133
- var newSet = [];
134
- for (var i = 0; i < this.indexesAndChoicesArrayLengthsSortedByLength.length; i++) {
135
- newChoicesArray[i] = this.choicesArrays[this.indexesAndChoicesArrayLengthsSortedByLength[i].index];
136
- newSet[i] = this.set[this.indexesAndChoicesArrayLengthsSortedByLength[i].index];
56
+ reorderListAndChoicesAccordingToChoicesCount() {
57
+ this.indexesAndChoicesCounts = [];
58
+ this.choicesArrays.forEach((list, ind) => this.indexesAndChoicesCounts.push({ index: ind, length: list.length }));
59
+ this.indexesAndChoicesCountsSortedByLength = this.indexesAndChoicesCounts
60
+ .slice()
61
+ .sort((el1, el2) => (el1.length < el2.length ? -1 : el1.length === el2.length && el1.index < el2.index ? -1 : 1));
62
+ const newChoicesArray = [];
63
+ const newSet = [];
64
+ for (let i = 0; i < this.indexesAndChoicesCountsSortedByLength.length; i++) {
65
+ newChoicesArray[i] = this.choicesArrays[this.indexesAndChoicesCountsSortedByLength[i].index];
66
+ newSet[i] = this.indexList[this.indexesAndChoicesCountsSortedByLength[i].index];
137
67
  }
138
68
  this.choicesArrays = newChoicesArray;
139
69
  this.choicesArraysInitial = JSON.parse(JSON.stringify(this.choicesArrays));
140
- };
141
- PermutationGeneratorForSet.prototype.revertResultPermToInitialOrder = function (newPerm) {
142
- var resultPerm = [];
143
- for (var i = 0; i < newPerm.length; i++) {
144
- resultPerm[this.indexesAndChoicesArrayLengthsSortedByLength[i].index] = newPerm[i];
145
- }
146
- return resultPerm;
147
- };
148
- PermutationGeneratorForSet.prototype.initChoicesArray = function () {
70
+ }
71
+ initChoicesArray() {
72
+ var _a, _b;
149
73
  this.choicesArrays = [];
150
74
  this.choicesArraysInitial = [];
151
- for (var i = 0; i < this.set.length; i++) {
152
- this.choicesArrays.push(this.choicesByIndex[i] && this.choicesByIndex[i].length ?
153
- this.choicesByIndex[i].slice() : this.set.slice());
154
- if (this.randomizeChoices) {
155
- Utils_1.Utils.shuffle(this.choicesArrays[i]);
156
- }
75
+ for (let i = 0; i < this.indexList.length; i++) {
76
+ this.choicesArrays.push(((_b = (_a = this.choicesByIndex) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.length) ? this.choicesByIndex[i].slice() : this.indexList.slice());
157
77
  this.choicesArraysInitial.push(this.choicesArrays[i].slice());
158
78
  }
159
- };
160
- PermutationGeneratorForSet.prototype.init = function () {
161
- // Initialize the new permutation
162
- for (var i = 0; i < this.numOfEl; i++) {
163
- for (var j = 0; j < this.choicesArrays[i].length; j++) {
79
+ }
80
+ init() {
81
+ for (let i = 0; i < this.size; i++) {
82
+ for (let j = 0; j < this.choicesArrays[i].length; j++) {
164
83
  if (this.newPerm.indexOf(this.choicesArrays[i][j]) < 0) {
165
84
  this.newPerm[i] = this.choicesArrays[i][j];
166
- this.elIsUsedDict[this.newPerm[i]] = true; // used
85
+ this.visitedDict[this.newPerm[i]] = true; // used
167
86
  this.currentIndsOfChoices[i] = j;
168
87
  break;
169
88
  }
170
89
  }
171
90
  }
172
- // Remove last element so that algorithm resolve it
173
- this.currentIndsOfChoices[this.numOfEl - 1] = -1; // make last element as to be next
174
- this.elIsUsedDict[this.newPerm[this.numOfEl - 1]] = false; // not-used
175
- this.newPerm[this.numOfEl - 1] = null;
176
- };
177
- PermutationGeneratorForSet.prototype.next = function () {
178
- var nextPerm = this.getNextPerm();
179
- if (nextPerm) {
180
- // If nextPerm does not include empty item, any undefined
181
- // ?? Understand, sometimes there is an empty element, case should be detected
182
- while (nextPerm.filter(function (x) { return x || x == 0; }).length < nextPerm.length) {
183
- nextPerm = this.getNextPerm();
184
- if (!nextPerm || nextPerm.length == 0) {
185
- return { done: true };
186
- }
187
- }
188
- return { done: false, value: this.revertResultPermToInitialOrder(nextPerm) };
189
- }
190
- else {
91
+ this.currentIndsOfChoices[this.size - 1] = -1;
92
+ this.visitedDict[this.newPerm[this.size - 1]] = false;
93
+ this.newPerm[this.size - 1] = null;
94
+ }
95
+ next() {
96
+ let nextPerm = this.getNextPerm();
97
+ if (!nextPerm || nextPerm.length === 0) {
191
98
  return { done: true };
192
99
  }
193
- };
194
- PermutationGeneratorForSet.prototype.getNextPerm = function () {
195
- var _this = this;
196
- var _loop_2 = function (i) {
197
- // To make consecutives different
198
- var elIndInPerm = this_2.indexesAndChoicesArrayLengthsSortedByLength[i].index;
199
- var prevElIndInPerm = this_2.indexesAndChoicesArrayLengthsSortedByLength.indexOf(this_2.indexesAndChoicesArrayLengths.filter(function (x) { return x.index == elIndInPerm - 1; })[0]);
200
- var choicesArray = [];
201
- try {
202
- choicesArray = this_2.choicesArraysInitial[i].filter(function (x) { return !_this.elIsUsedDict[x]; });
100
+ while (nextPerm.filter((x) => x || x === 0).length < nextPerm.length) {
101
+ nextPerm = this.getNextPerm();
102
+ if (!nextPerm || nextPerm.length === 0) {
103
+ return { done: true };
203
104
  }
204
- catch (error) {
205
- }
206
- var el = this_2.getAndSetPossibleNextElementForNewPerm(this_2.newPerm, choicesArray, this_2.currentIndsOfChoices, i);
207
- while (el == 'EXISTINARRAY' || el == 'TRIEDBEFORE') {
208
- el = this_2.getAndSetPossibleNextElementForNewPerm(this_2.newPerm, choicesArray, this_2.currentIndsOfChoices, i);
209
- }
210
- if (!el && el != 0) { // if el is undefined or null
211
- if (this_2.newPerm.filter(function (x) { return x == null; }).length == 0) { // if it is done, return completed
212
- return { value: this_2.newPerm.slice() };
105
+ }
106
+ return { done: false, value: this.revertResultPermToInitialOrder(nextPerm) };
107
+ }
108
+ getNextPerm() {
109
+ for (let i = this.size - 1; i >= 0 && i < this.size; i++) {
110
+ let choicesArray = [];
111
+ choicesArray = this.choicesArraysInitial[i].filter((x) => !this.visitedDict[x]);
112
+ const el = this.getAndSetPossibleNextElementForNewPerm(this.newPerm, choicesArray, this.currentIndsOfChoices, i);
113
+ if (el === undefined) {
114
+ if (!this.newPerm.some((x) => x === null)) {
115
+ return this.newPerm.slice();
213
116
  }
214
- while (!this_2.goBack(this_2.newPerm, this_2.choicesArrays, this_2.currentIndsOfChoices, --i)) {
215
- if (i <= 0) { // if there is only one element, then i can be less than 0, that is negative
216
- return { value: void 0 };
117
+ while (!this.goBack(this.newPerm, this.choicesArrays, this.currentIndsOfChoices, --i)) {
118
+ if (i <= 0) {
119
+ return undefined;
217
120
  }
218
121
  }
219
122
  }
220
123
  else {
221
- this_2.elIsUsedDict[this_2.newPerm[i]] = false; // old one, not-used
222
- this_2.newPerm[i] = el;
223
- this_2.elIsUsedDict[this_2.newPerm[i]] = true; // new one, used
124
+ this.newPerm[i] = el;
125
+ this.visitedDict[el] = true;
224
126
  }
225
- out_i_1 = i;
226
- };
227
- var this_2 = this, out_i_1;
228
- for (var i = this.numOfEl - 1; i >= 0 && i < this.numOfEl; i++) {
229
- var state_1 = _loop_2(i);
230
- i = out_i_1;
231
- if (typeof state_1 === "object")
232
- return state_1.value;
233
127
  }
234
128
  return this.newPerm.slice();
235
- };
236
- PermutationGeneratorForSet.prototype.goBack = function (newPerm, choicesArrays, currentIndsInChoices, elInd) {
237
- // reset chocies arrays until end, there should not be need but code is a little buggy
238
- choicesArrays[elInd] = (this.choicesArraysInitial[elInd] || []).slice();
239
- if (elInd + 1 < choicesArrays.length) {
240
- choicesArrays[elInd + 1] = (this.choicesArraysInitial[elInd + 1] || []).slice();
241
- }
242
- if (elInd >= 0 && elInd < this.numOfEl) {
243
- if (currentIndsInChoices[elInd] < choicesArrays[elInd].length - 1) {
244
- currentIndsInChoices[elInd + 1] = -1; // Reset old
245
- this.elIsUsedDict[newPerm[elInd + 1]] = false;
246
- newPerm[elInd + 1] = null;
247
- currentIndsInChoices[elInd]++; // increment current
248
- if (!this.elIsUsedDict[choicesArrays[elInd][currentIndsInChoices[elInd]]]
249
- &&
250
- this.isNewPermWithNewElementConsecutivelyDifferent(choicesArrays[elInd][currentIndsInChoices[elInd]], currentIndsInChoices[elInd], elInd)) {
251
- this.elIsUsedDict[newPerm[elInd]] = false; // not-used
252
- newPerm[elInd] = choicesArrays[elInd][currentIndsInChoices[elInd]];
253
- this.elIsUsedDict[newPerm[elInd]] = true; // used
129
+ }
130
+ goBack(newPerm, choicesArrayWithIndexes, selectedIndexesForPerm, elInd) {
131
+ if (elInd + 1 < choicesArrayWithIndexes.length) {
132
+ choicesArrayWithIndexes[elInd + 1] = this.choicesArraysInitial[elInd + 1].slice();
133
+ selectedIndexesForPerm[elInd + 1] = -1;
134
+ this.visitedDict[newPerm[elInd + 1]] = false;
135
+ newPerm[elInd + 1] = null;
136
+ }
137
+ if (elInd >= 0 && elInd < this.size) {
138
+ choicesArrayWithIndexes[elInd] = this.choicesArraysInitial[elInd].slice();
139
+ if (selectedIndexesForPerm[elInd] === choicesArrayWithIndexes[elInd].length - 1) {
140
+ return false;
141
+ }
142
+ else {
143
+ selectedIndexesForPerm[elInd]++;
144
+ if (!this.visitedDict[choicesArrayWithIndexes[elInd][selectedIndexesForPerm[elInd]]] &&
145
+ this.isNewPermutationPassingFunction(choicesArrayWithIndexes[elInd][selectedIndexesForPerm[elInd]], elInd)) {
146
+ this.visitedDict[newPerm[elInd]] = false;
147
+ newPerm[elInd] = choicesArrayWithIndexes[elInd][selectedIndexesForPerm[elInd]];
148
+ this.visitedDict[newPerm[elInd]] = true;
254
149
  return true;
255
150
  }
256
151
  else {
257
- return this.goBack(newPerm, choicesArrays, currentIndsInChoices, elInd);
152
+ return this.goBack(newPerm, choicesArrayWithIndexes, selectedIndexesForPerm, elInd);
258
153
  }
259
154
  }
260
- else {
261
- currentIndsInChoices[elInd + 1] = -1; // Reset old
262
- this.elIsUsedDict[newPerm[elInd + 1]] = false; // not-used
263
- newPerm[elInd + 1] = null;
264
- return false;
265
- }
266
155
  }
267
- // choicesArrays[elInd + 1] = this.choicesArraysInitial[elInd + 1].slice()
268
156
  return false;
269
- };
270
- PermutationGeneratorForSet.prototype.getAndSetPossibleNextElementForNewPerm = function (newPerm, choices, currentIndsInChoices, elInd) {
271
- var _this = this;
272
- // debugger
273
- if (elInd >= this.numOfEl) {
274
- currentIndsInChoices[elInd] = 0; // will go back
275
- return null;
276
- }
277
- // If current element index does not exist then set it to zero
278
- if (!(currentIndsInChoices[elInd] >= 0)) {
279
- currentIndsInChoices[elInd] = 0; // try starting from 0
157
+ }
158
+ getAndSetPossibleNextElementForNewPerm(newPerm, choices, currentIndsInChoices, elInd) {
159
+ if (currentIndsInChoices[elInd] < 0) {
160
+ currentIndsInChoices[elInd] = 0;
280
161
  }
281
162
  else {
282
163
  currentIndsInChoices[elInd]++;
283
164
  }
284
165
  if (currentIndsInChoices[elInd] >= 0 && currentIndsInChoices[elInd] < choices.length) {
285
- // If exist any where in new perm
286
- if (!this.isNewPermWithNewElementConsecutivelyDifferent(choices[currentIndsInChoices[elInd]], currentIndsInChoices[elInd], elInd)) {
287
- return 'EXISTINARRAY';
166
+ if (!this.isNewPermutationPassingFunction(choices[currentIndsInChoices[elInd]], elInd)) {
167
+ return this.getAndSetPossibleNextElementForNewPerm(newPerm, choices, currentIndsInChoices, elInd);
288
168
  }
289
- this.elIsUsedDict[newPerm[elInd]] = false;
290
169
  newPerm[elInd] = choices[currentIndsInChoices[elInd]];
291
- this.elIsUsedDict[newPerm[elInd]] = true;
292
- // from the choices list Remove the same elements with the one which is set right now
293
- this.choicesArrays[elInd] = this.choicesArrays[elInd].filter(function (x) {
294
- return _this.indexesOfSameElements[newPerm[elInd]] && _this.indexesOfSameElements[newPerm[elInd]].indexOf(x) == -1;
170
+ this.visitedDict[newPerm[elInd]] = true;
171
+ this.choicesArrays[elInd] = this.choicesArrays[elInd].filter((x) => {
172
+ var _a;
173
+ return ((_a = this.indexesOfSameElements) === null || _a === void 0 ? void 0 : _a[newPerm[elInd]]) &&
174
+ this.indexesOfSameElements[newPerm[elInd]].indexOf(x) === -1;
295
175
  });
296
176
  return choices[currentIndsInChoices[elInd]];
297
177
  }
298
178
  else {
299
- this.elIsUsedDict[newPerm[elInd]] = false;
179
+ this.visitedDict[newPerm[elInd]] = false;
300
180
  currentIndsInChoices[elInd] = -1;
301
181
  newPerm[elInd] = null;
182
+ return undefined;
302
183
  }
303
- return undefined;
304
- };
305
- PermutationGeneratorForSet.prototype.validateParameters = function (elementSet, choicesByIndex) {
306
- if (!elementSet || elementSet.length == 0) {
307
- console.warn('Element list to permutate should be provided!');
184
+ }
185
+ validateParameters(elementSet, choicesByIndex) {
186
+ if (!elementSet || elementSet.length === 0) {
308
187
  return false;
309
188
  }
310
- var keys = Object.keys(choicesByIndex);
311
- for (var i = 0; i < keys.length; i++) {
312
- for (var j = 0; j < choicesByIndex[keys[i]].length; j++) {
313
- if (elementSet.indexOf(choicesByIndex[keys[i]][j]) < 0) {
314
- console.warn('All choices should be in set!');
189
+ for (const key in choicesByIndex) {
190
+ if (!choicesByIndex[key]) {
191
+ continue;
192
+ }
193
+ for (const anotherKey of choicesByIndex[key]) {
194
+ if (elementSet.indexOf(anotherKey) < 0) {
315
195
  return false;
316
196
  }
317
197
  }
318
198
  }
319
199
  return true;
320
- };
321
- return PermutationGeneratorForSet;
322
- }());
200
+ }
201
+ revertResultPermToInitialOrder(newPerm) {
202
+ const resultPerm = [];
203
+ for (let i = 0; i < newPerm.length; i++) {
204
+ resultPerm[this.indexesAndChoicesCountsSortedByLength[i].index] = newPerm[i];
205
+ }
206
+ return resultPerm;
207
+ }
208
+ }
323
209
  exports.PermutationGeneratorForSet = PermutationGeneratorForSet;
324
210
  //# sourceMappingURL=PermutationGeneratorForSet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PermutationGeneratorForSet.js","sourceRoot":"","sources":["../src/PermutationGeneratorForSet.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAEhC;IAiBE,oCAAoB,WAAkB,EAC5B,GAAU,EAAE,eAAe;IAC3B,cAAuB,EAAU,qBAAsB,EACvD,qBAA6B,EAAU,YAAuB,EAAU,gBAA0B;QAHxF,gBAAW,GAAX,WAAW,CAAO;QAC5B,QAAG,GAAH,GAAG,CAAO;QACV,mBAAc,GAAd,cAAc,CAAS;QAAU,0BAAqB,GAArB,qBAAqB,CAAC;QACvD,0BAAqB,GAArB,qBAAqB,CAAQ;QAAU,iBAAY,GAAZ,YAAY,CAAW;QAAU,qBAAgB,GAAhB,gBAAgB,CAAU;QAlB5G,yBAAoB,GAAG,EAAE,CAAC,CAAC,+DAA+D;QAC1F,kBAAa,GAAG,EAAE,CAAC,CAAS,+DAA+D;QAC3F,YAAO,GAAG,CAAC,CAAC;QACZ,yBAAoB,GAAG,EAAE,CAAC,CAAE,0CAA0C;QACtE,iBAAY,GAAG,CAAC,CAAC,CAAW,+CAA+C;QAC3E,YAAO,GAAG,EAAE,CAAC,CAAe,2BAA2B;QACvD,eAAU,GAAG,EAAE,CAAC,CAAY,mCAAmC;QAE/D,gCAA2B,GAAG,EAAE,CAAC;QAGjC,yDAAoD,GAAG,EAAE,CAAC;QAE1D,iBAAY,GAAG,EAAE,CAAC,CAAE,kDAAkD;QAMpE,sEAAsE;QACtE,mFAAmF;QACnF,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC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AC,CAAC,CAAC;YACjC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;SACvB;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,uDAAkB,GAAlB,UAAmB,UAAU,EAAE,cAAc;QAC3C,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE;YACzC,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;YAC9D,OAAO,KAAK,CAAC;SACd;QAED,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAEvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACvD,IAAI,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;oBACtD,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;oBAC9C,OAAO,KAAK,CAAC;iBACd;aACF;SAEF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEH,iCAAC;AAAD,CAAC,AApXD,IAoXC;AApXY,gEAA0B"}
1
+ {"version":3,"file":"PermutationGeneratorForSet.js","sourceRoot":"","sources":["../src/PermutationGeneratorForSet.ts"],"names":[],"mappings":";;;AAEA,MAAa,0BAA0B;IAcrC,YACU,WAAkB,EAClB,SAAmB,EACnB,cAAyC,EACzC,qBAAgD,EAChD,qBAAgC,EAChC,YAAwC;QALxC,gBAAW,GAAX,WAAW,CAAO;QAClB,cAAS,GAAT,SAAS,CAAU;QACnB,mBAAc,GAAd,cAAc,CAA2B;QACzC,0BAAqB,GAArB,qBAAqB,CAA2B;QAChD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oB,EAAE,cAAuB;QAC9D,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3C,OAAO,KAAK,CAAC;QACf,CAAC;QAED,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;YACjC,IAAI,CAAC,cAAc,CAAC,GAAkC,CAAC,EAAE,CAAC;gBACxD,SAAS;YACX,CAAC;YAED,KAAK,MAAM,UAAU,IAAI,cAAc,CAAC,GAAkC,CAAa,EAAE,CAAC;gBACxF,IAAI,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBACvC,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,8BAA8B,CAAC,OAA0B;QACvD,MAAM,UAAU,GAAsB,EAAE,CAAC;QAEzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,UAAU,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/E,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AAnQD,gEAmQC"}
package/lib/demo.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/lib/demo.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const CustomPermutation_1 = require("./CustomPermutation");
4
+ let customPerm = new CustomPermutation_1.default([], {}, {});
5
+ while (true) {
6
+ const next = customPerm.next();
7
+ if (!next) {
8
+ break;
9
+ }
10
+ console.log(next);
11
+ }
12
+ //# sourceMappingURL=demo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo.js","sourceRoot":"","sources":["../src/demo.ts"],"names":[],"mappings":";;AAAA,2DAAoD;AAEpD,IAAI,UAAU,GAAG,IAAI,2BAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACnD,OAAO,IAAI,EAAE,CAAC;IACZ,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IAE/B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM;IACR,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export { default } from './CustomPermutation';
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = void 0;
3
4
  var CustomPermutation_1 = require("./CustomPermutation");
4
- module.exports = CustomPermutation_1.default;
5
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return CustomPermutation_1.default; } });
5
6
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,yDAAoD;AACpD,MAAM,CAAC,OAAO,GAAG,2BAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA8C;AAArC,4GAAA,OAAO,OAAA"}
package/package.json CHANGED
@@ -1,19 +1,23 @@
1
1
  {
2
2
  "name": "custom-permutation",
3
- "version": "1.0.7",
3
+ "version": "1.1.1",
4
+ "engines": {
5
+ "node": ">=18.0.0"
6
+ },
4
7
  "description": "Permutation generator with custom options.",
5
8
  "main": "lib/index.js",
6
9
  "types": "lib/index.d.ts",
7
10
  "scripts": {
8
11
  "test": "jest --config jestconfig.json",
9
12
  "build": "tsc",
10
- "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
11
- "lint": "tslint -p tsconfig.json",
13
+ "format": "prettier --write \"src/**/*.ts\"",
14
+ "lint": "eslint src",
12
15
  "prepare": "npm run build",
13
16
  "prepublishOnly": "npm test && npm run preversion",
14
- "preversion": "true || npm run lint",
17
+ "preversion": "npm run lint",
15
18
  "version": "npm run format && git add -A src",
16
- "postversion": "git push && git push --tags"
19
+ "postversion": "git push && git push --tags",
20
+ "demo": "ts-node src/demo.ts"
17
21
  },
18
22
  "repository": {
19
23
  "type": "git",
@@ -29,19 +33,22 @@
29
33
  "Permutation with Options"
30
34
  ],
31
35
  "author": "@yilmazhasan",
32
- "license": "ISC",
36
+ "license": "GPL-3.0",
33
37
  "bugs": {
34
38
  "url": "https://github.com/yilmazhasan/custom-permutation/issues"
35
39
  },
36
40
  "homepage": "https://github.com/yilmazhasan/custom-permutation#readme",
37
41
  "devDependencies": {
38
- "@types/jest": "^26.0.23",
39
- "jest": "^27.0.6",
40
- "prettier": "^2.3.2",
41
- "ts-jest": "^27.0.3",
42
- "tslint": "^6.1.3",
43
- "tslint-config-prettier": "^1.18.0",
44
- "typescript": "^4.3.5"
45
- },
46
- "dependencies": {}
42
+ "@types/jest": "^29.5.14",
43
+ "@types/node": "^25.9.3",
44
+ "@typescript-eslint/eslint-plugin": "^8.61.0",
45
+ "@typescript-eslint/parser": "^8.61.0",
46
+ "eslint": "^10.4.1",
47
+ "eslint-config-prettier": "^10.1.8",
48
+ "jest": "^29.7.0",
49
+ "prettier": "^3.8.4",
50
+ "ts-jest": "^29.4.11",
51
+ "ts-node": "^10.9.2",
52
+ "typescript": "^5.9.3"
53
+ }
47
54
  }