custom-permutation 1.0.4 → 1.0.6
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.
- package/README.md +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ CustomPermutation(elList:[els...], choices:{ index: [els...]] }, nonChoices:{ in
|
|
|
7
7
|
_example:_\
|
|
8
8
|
`CustomPermutation(['a', 'b', 'c'], {1: ['a', 'b']}, {0: ['a']})`
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Permutate 3 elements which are 'a', 'b' and 'c' with below rules
|
|
11
11
|
|
|
12
12
|
__1. choices rule:__ `{ 1: ['a', 'b'] }`
|
|
13
13
|
|
|
@@ -15,13 +15,13 @@ __1. choices rule:__ `{ 1: ['a', 'b'] }`
|
|
|
15
15
|
|
|
16
16
|
__2. nonChoices rule:__ `{ 0: ['a'] }`
|
|
17
17
|
|
|
18
|
-
At index=0
|
|
18
|
+
At index=0 there can NOT be element 'a'
|
|
19
19
|
|
|
20
20
|
_Note: given index are considered as 0 based: [index=0, index=1, etc]_
|
|
21
21
|
|
|
22
22
|
__Result set:__
|
|
23
23
|
|
|
24
|
-
Let's see all permutations, and which ones are valid
|
|
24
|
+
Let's see all permutations, and which ones are valid or not.
|
|
25
25
|
- `['a', 'b', 'c']` : violates nonChoices rule: _first element is `'a'`, but shouldn't be `'a'`
|
|
26
26
|
- `['a', 'c', 'b']` : violates nonChoices rule: _first element is `'a'`, but shouldn't be `'a'`_
|
|
27
27
|
- `['b', 'a', 'c']` : ok
|
|
@@ -29,7 +29,7 @@ Let's see all permutations, and which ones are valid and not.
|
|
|
29
29
|
- `['c', 'a', 'b']` : ok
|
|
30
30
|
- `['c', 'b', 'a']` : ok
|
|
31
31
|
|
|
32
|
-
So there
|
|
32
|
+
So there are just 3 results that should be generated with this parameters.
|
|
33
33
|
```javascript
|
|
34
34
|
let customPerm = new CustomPermutation(['a', 'b', 'c'], { 1: ['a', 'b'] }, { 0: ['a'] });
|
|
35
35
|
let gen = customPerm.generator();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "custom-permutation",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Permutation generator with custom options.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
|
|
11
11
|
"lint": "tslint -p tsconfig.json",
|
|
12
12
|
"prepare": "npm run build",
|
|
13
|
-
"prepublishOnly": "npm test",
|
|
14
|
-
"preversion": "",
|
|
13
|
+
"prepublishOnly": "npm test && npm run preversion",
|
|
14
|
+
"preversion": "true || npm run lint",
|
|
15
15
|
"version": "npm run format && git add -A src",
|
|
16
16
|
"postversion": "git push && git push --tags"
|
|
17
17
|
},
|