@thi.ng/arrays 2.0.6 → 2.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.
package/CHANGELOG.md CHANGED
@@ -1,155 +1,165 @@
1
1
  # Change Log
2
2
 
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [2.0.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@2.0.5...@thi.ng/arrays@2.0.6) (2021-10-28)
7
-
8
- **Note:** Version bump only for package @thi.ng/arrays
9
-
10
-
11
-
12
-
13
-
14
- ## [2.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@2.0.4...@thi.ng/arrays@2.0.5) (2021-10-28)
15
-
16
- **Note:** Version bump only for package @thi.ng/arrays
17
-
18
-
19
-
20
-
21
-
22
- ## [2.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@2.0.3...@thi.ng/arrays@2.0.4) (2021-10-25)
3
+ - **Last updated**: 2021-11-19T07:59:50Z
4
+ - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
23
5
 
24
- **Note:** Version bump only for package @thi.ng/arrays
25
-
26
-
27
-
28
-
29
-
30
- ## [2.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@2.0.2...@thi.ng/arrays@2.0.3) (2021-10-15)
31
-
32
- **Note:** Version bump only for package @thi.ng/arrays
33
-
34
-
35
-
36
-
37
-
38
- ## [2.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@2.0.1...@thi.ng/arrays@2.0.2) (2021-10-15)
39
-
40
- **Note:** Version bump only for package @thi.ng/arrays
6
+ All notable changes to this project will be documented in this file.
7
+ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
41
8
 
9
+ **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
+ and/or version bumps of transitive dependencies.
42
11
 
12
+ ## [2.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@2.1.0) (2021-11-17)
43
13
 
14
+ #### 🚀 Features
44
15
 
16
+ - Using workspaces for local tools ([bf7a404](https://github.com/thi-ng/umbrella/commit/bf7a404))
17
+ Improving the overall build ergonomics
18
+ - introduced a tools workspaces
19
+ - imported it in all needed packages/examples
20
+ - inclusive project root
45
21
 
46
- ## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@2.0.0...@thi.ng/arrays@2.0.1) (2021-10-13)
22
+ #### ♻️ Refactoring
47
23
 
48
- **Note:** Version bump only for package @thi.ng/arrays
24
+ - testrunner to binary ([4ebbbb2](https://github.com/thi-ng/umbrella/commit/4ebbbb2))
25
+ this commit reverts (partly) changes made in:
26
+ ef346d7a8753590dc9094108a3d861a8dbd5dd2c
27
+ overall purpose is better testament ergonomics:
28
+ instead of having to pass NODE_OPTIONS with every invocation
29
+ having a binary to handle this for us.
49
30
 
31
+ ### [2.0.8](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@2.0.8) (2021-11-10)
50
32
 
33
+ #### ♻️ Refactoring
51
34
 
35
+ - update all countdown loops ([a5f374b](https://github.com/thi-ng/umbrella/commit/a5f374b))
52
36
 
37
+ ### [2.0.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@2.0.1) (2021-10-13)
53
38
 
54
- # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@1.0.3...@thi.ng/arrays@2.0.0) (2021-10-12)
39
+ #### ♻️ Refactoring
55
40
 
41
+ - update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
42
+ - update imports in all pkgs ([5fa2b6f](https://github.com/thi-ng/umbrella/commit/5fa2b6f))
43
+ - add .js suffix for all relative imports
56
44
 
57
- ### Build System
45
+ # [2.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@2.0.0) (2021-10-12)
58
46
 
59
- * major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
47
+ #### 🛑 Breaking changes
60
48
 
49
+ - major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea))
50
+ - BREAKING CHANGE: discontinue CommonJS & UMD versions
51
+ - only ESM modules will be published from now on
52
+ - CJS obsolete due to ESM support in recent versions of node:
53
+ - i.e. launch NodeJS via:
54
+ - `node --experimental-specifier-resolution=node --experimental-repl-await`
55
+ - in the node REPL use `await import(...)` instead of `require()`
56
+ - UMD obsolete due to widespread browser support for ESM
57
+ Also:
58
+ - normalize/restructure/reorg all package.json files
59
+ - cleanup all build scripts, remove obsolete
60
+ - switch from mocha to [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament) for all tests
61
61
 
62
- ### BREAKING CHANGES
62
+ #### ♻️ Refactoring
63
63
 
64
- * discontinue CommonJS & UMD versions
64
+ - update deps & imports in various pkgs ([e1cf29e](https://github.com/thi-ng/umbrella/commit/e1cf29e))
65
+ - largely related to recent updates/restructuring of these packages:
66
+ - api
67
+ - defmulti
68
+ - errors
69
+ - logger
70
+ - update imports ([ad3c3af](https://github.com/thi-ng/umbrella/commit/ad3c3af))
71
+ - update all tests in _all_ pkgs ([8b582bc](https://github.com/thi-ng/umbrella/commit/8b582bc))
72
+ - update all to use [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament)
65
73
 
66
- - only ESM modules will be published from now on
67
- - CJS obsolete due to ESM support in recent versions of node:
68
- - i.e. launch NodeJS via:
69
- - `node --experimental-specifier-resolution=node --experimental-repl-await`
70
- - in the node REPL use `await import(...)` instead of `require()`
71
- - UMD obsolete due to widespread browser support for ESM
74
+ ## [0.10.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.10.0) (2021-01-21)
72
75
 
73
- Also:
74
- - normalize/restructure/reorg all package.json files
75
- - cleanup all build scripts, remove obsolete
76
- - switch from mocha to @thi.ng/testament for all tests
76
+ #### 🚀 Features
77
77
 
78
+ - add insert/insertUnsafe() ([2a78598](https://github.com/thi-ng/umbrella/commit/2a78598))
78
79
 
80
+ #### 🩹 Bug fixes
79
81
 
82
+ - fixed-length binarySearch2/4/8/16/32 ([39e5c37](https://github.com/thi-ng/umbrella/commit/39e5c37))
83
+ - add binarySearch2()
84
+ - fix results for not-found values, make compatible w/ binarySearch()
80
85
 
86
+ ## [0.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.9.0) (2021-01-02)
81
87
 
88
+ #### 🚀 Features
82
89
 
83
- ## [1.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@1.0.2...@thi.ng/arrays@1.0.3) (2021-09-03)
90
+ - update sortByCachedKey(), add tests ([64e8f6e](https://github.com/thi-ng/umbrella/commit/64e8f6e))
91
+ - add support for pre-cached key array instead of key fn
92
+ - add into(), sortByCachedKey() ([b94f64c](https://github.com/thi-ng/umbrella/commit/b94f64c))
93
+ - add bisect(), bisectWith() ([17d06a4](https://github.com/thi-ng/umbrella/commit/17d06a4))
84
94
 
85
- **Note:** Version bump only for package @thi.ng/arrays
95
+ ## [0.8.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.8.0) (2020-09-13)
86
96
 
87
- # [0.10.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.9.2...@thi.ng/arrays@0.10.0) (2021-01-21)
97
+ #### 🚀 Features
88
98
 
89
- ### Bug Fixes
99
+ - add first() ([3f5f722](https://github.com/thi-ng/umbrella/commit/3f5f722))
90
100
 
91
- - **arrays:** fixed-length binarySearch2/4/8/16/32 ([39e5c37](https://github.com/thi-ng/umbrella/commit/39e5c3736135f9a49daceee1fe4da9fbdbb96eab))
101
+ #### ♻️ Refactoring
92
102
 
93
- ### Features
103
+ - update imports, use new Fn types ([1e3b6ac](https://github.com/thi-ng/umbrella/commit/1e3b6ac))
104
+ - update imports, use new function aliases ([136482e](https://github.com/thi-ng/umbrella/commit/136482e))
94
105
 
95
- - **arrays:** add insert/insertUnsafe() ([2a78598](https://github.com/thi-ng/umbrella/commit/2a7859823d2fb56eef4ee7a6919fe70072475f42))
106
+ ## [0.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.7.0) (2020-08-28)
96
107
 
97
- # [0.9.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.8.5...@thi.ng/arrays@0.9.0) (2021-01-02)
108
+ #### 🚀 Features
98
109
 
99
- ### Features
110
+ - add non-recursive binary search fns ([29a4ee4](https://github.com/thi-ng/umbrella/commit/29a4ee4))
111
+ - add fixed size binarySearch4/8/16/32()
100
112
 
101
- - **arrays:** add bisect(), bisectWith() ([17d06a4](https://github.com/thi-ng/umbrella/commit/17d06a43e338aca5f2dc61110382363639daecc5))
102
- - **arrays:** add into(), sortByCachedKey() ([b94f64c](https://github.com/thi-ng/umbrella/commit/b94f64c2c351cfed5ea9ade5e42ad0b7076ef9e9))
103
- - **arrays:** update sortByCachedKey(), add tests ([64e8f6e](https://github.com/thi-ng/umbrella/commit/64e8f6e4e83c26c73e23a4831483bd328b78bc49))
113
+ ## [0.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.6.0) (2020-03-28)
104
114
 
105
- # [0.8.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.7.0...@thi.ng/arrays@0.8.0) (2020-09-13)
115
+ #### 🚀 Features
106
116
 
107
- ### Features
117
+ - add fillRange() & levenshtein() ([2f98225](https://github.com/thi-ng/umbrella/commit/2f98225))
108
118
 
109
- - **arrays:** add first() ([3f5f722](https://github.com/thi-ng/umbrella/commit/3f5f7226e5c0495086c973a33e91fc2666f4c68c))
119
+ ### [0.5.2](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.5.2) (2020-02-25)
110
120
 
111
- # [0.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.6.15...@thi.ng/arrays@0.7.0) (2020-08-28)
121
+ #### ♻️ Refactoring
112
122
 
113
- ### Features
123
+ - update imports ([35765a8](https://github.com/thi-ng/umbrella/commit/35765a8))
114
124
 
115
- - **arrays:** add non-recursive binary search fns ([29a4ee4](https://github.com/thi-ng/umbrella/commit/29a4ee4d888ccb049df9b50a57e3884ce2d4d0f3))
125
+ ## [0.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.5.0) (2020-01-24)
116
126
 
117
- # [0.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.5.6...@thi.ng/arrays@0.6.0) (2020-03-28)
127
+ #### 🚀 Features
118
128
 
119
- ### Features
129
+ - add binary search predicates, tests, update readme ([b8f421e](https://github.com/thi-ng/umbrella/commit/b8f421e))
120
130
 
121
- - **arrays:** add fillRange() & levenshtein() ([2f98225](https://github.com/thi-ng/umbrella/commit/2f98225d129c7c1ae6b88a4f0bea9227254fcf91))
131
+ ## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.4.0) (2019-11-30)
122
132
 
123
- # [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.4.0...@thi.ng/arrays@0.5.0) (2020-01-24)
133
+ #### 🚀 Features
124
134
 
125
- ### Features
135
+ - add arraySeq(), arrayIterator() & tests ([d94df57](https://github.com/thi-ng/umbrella/commit/d94df57))
136
+ - add binarySearchNumeric() ([7b38202](https://github.com/thi-ng/umbrella/commit/7b38202))
126
137
 
127
- - **arrays:** add binary search predicates, tests, update readme ([b8f421e](https://github.com/thi-ng/umbrella/commit/b8f421eb8888fa1b57a9287f6841cd29952bf19f))
138
+ #### ♻️ Refactoring
128
139
 
129
- # [0.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.3.0...@thi.ng/arrays@0.4.0) (2019-11-30)
140
+ - remove arraySeq() (migrated to [@thi.ng/seq](https://github.com/thi-ng/umbrella/tree/main/packages/seq)) ([779c433](https://github.com/thi-ng/umbrella/commit/779c433))
130
141
 
131
- ### Features
142
+ ## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.3.0) (2019-11-09)
132
143
 
133
- - **arrays:** add arraySeq(), arrayIterator() & tests ([d94df57](https://github.com/thi-ng/umbrella/commit/d94df5786dddf6ef6915af79c3fbf0331ddfd2bd))
134
- - **arrays:** add binarySearchNumeric() ([7b38202](https://github.com/thi-ng/umbrella/commit/7b38202480db71753d24aa52a9c09d3ac78d36ae))
144
+ #### 🚀 Features
135
145
 
136
- # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.2.5...@thi.ng/arrays@0.3.0) (2019-11-09)
146
+ - add isSorted() ([65b29f4](https://github.com/thi-ng/umbrella/commit/65b29f4))
147
+ - add types, quickSort(), swap(), multiSwap(), update readme ([b834722](https://github.com/thi-ng/umbrella/commit/b834722))
148
+ - add shuffleRange(), refactor shuffle(), add tests ([1924a05](https://github.com/thi-ng/umbrella/commit/1924a05))
137
149
 
138
- ### Features
150
+ ## [0.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.2.0) (2019-07-07)
139
151
 
140
- - **arrays:** add isSorted() ([65b29f4](https://github.com/thi-ng/umbrella/commit/65b29f487459c535acdbed3890c8a4e27d87ae2c))
141
- - **arrays:** add shuffleRange(), refactor shuffle(), add tests ([1924a05](https://github.com/thi-ng/umbrella/commit/1924a05ea093e3d1d0b3f063cb331b330cee0c0a))
142
- - **arrays:** add types, quickSort(), swap(), multiSwap(), update readme ([b834722](https://github.com/thi-ng/umbrella/commit/b83472237b3ba262dcbb644c8ccc516d0021bc84))
152
+ #### 🚀 Features
143
153
 
144
- # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.1.9...@thi.ng/arrays@0.2.0) (2019-07-07)
154
+ - enable TS strict compiler flags (refactor) ([8724f9e](https://github.com/thi-ng/umbrella/commit/8724f9e))
145
155
 
146
- ### Features
156
+ ## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@0.1.0) (2019-02-15)
147
157
 
148
- - **arrays:** enable TS strict compiler flags (refactor) ([8724f9e](https://github.com/thi-ng/umbrella/commit/8724f9e))
158
+ #### 🚀 Features
149
159
 
150
- # 0.1.0 (2019-02-15)
160
+ - add find/findIndex() ([0007152](https://github.com/thi-ng/umbrella/commit/0007152))
161
+ - extract as new package ([361ba37](https://github.com/thi-ng/umbrella/commit/361ba37))
151
162
 
152
- ### Features
163
+ #### ♻️ Refactoring
153
164
 
154
- - **arrays:** add find/findIndex() ([0007152](https://github.com/thi-ng/umbrella/commit/0007152))
155
- - **arrays:** extract as new package ([361ba37](https://github.com/thi-ng/umbrella/commit/361ba37))
165
+ - update arg order, fix shuffle() ([b01abaa](https://github.com/thi-ng/umbrella/commit/b01abaa))
package/README.md CHANGED
@@ -51,7 +51,7 @@ node --experimental-repl-await
51
51
  > const arrays = await import("@thi.ng/arrays");
52
52
  ```
53
53
 
54
- Package sizes (gzipped, pre-treeshake): ESM: 2.12 KB
54
+ Package sizes (gzipped, pre-treeshake): ESM: 2.24 KB
55
55
 
56
56
  ## Dependencies
57
57
 
package/ends-with.js CHANGED
@@ -20,6 +20,6 @@ export const endsWith = (buf, needle, equiv = _eq) => {
20
20
  let j = needle.length;
21
21
  if (i < j)
22
22
  return false;
23
- while ((--i, --j >= 0 && equiv(buf[i], needle[j]))) { }
23
+ while ((--i, j-- > 0 && equiv(buf[i], needle[j]))) { }
24
24
  return j < 0;
25
25
  };
package/find.js CHANGED
@@ -20,7 +20,7 @@ export const find = (buf, x, equiv = _equiv) => {
20
20
  * @param equiv - equivalence predicate
21
21
  */
22
22
  export const findIndex = (buf, x, equiv = _equiv) => {
23
- for (let i = buf.length; --i >= 0;) {
23
+ for (let i = buf.length; i-- > 0;) {
24
24
  if (equiv(x, buf[i]))
25
25
  return i;
26
26
  }
package/package.json CHANGED
@@ -1,139 +1,144 @@
1
1
  {
2
- "name": "@thi.ng/arrays",
3
- "version": "2.0.6",
4
- "description": "Array / Arraylike utilities",
5
- "type": "module",
6
- "module": "./index.js",
7
- "typings": "./index.d.ts",
8
- "sideEffects": false,
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/thi-ng/umbrella.git"
12
- },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/arrays#readme",
14
- "funding": [
15
- {
16
- "type": "github",
17
- "url": "https://github.com/sponsors/postspectacular"
18
- },
19
- {
20
- "type": "patreon",
21
- "url": "https://patreon.com/thing_umbrella"
22
- }
23
- ],
24
- "author": "Karsten Schmidt <k+npm@thi.ng>",
25
- "license": "Apache-2.0",
26
- "scripts": {
27
- "build": "yarn clean && tsc --declaration",
28
- "clean": "rimraf *.js *.d.ts *.map doc",
29
- "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
- "doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
31
- "doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
32
- "doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
33
- "pub": "yarn build && yarn publish --access public",
34
- "test": "testament test"
35
- },
36
- "dependencies": {
37
- "@thi.ng/api": "^8.0.6",
38
- "@thi.ng/checks": "^3.0.6",
39
- "@thi.ng/compare": "^2.0.6",
40
- "@thi.ng/equiv": "^2.0.6",
41
- "@thi.ng/errors": "^2.0.6",
42
- "@thi.ng/random": "^3.1.2"
43
- },
44
- "devDependencies": {
45
- "@thi.ng/testament": "^0.1.6"
46
- },
47
- "keywords": [
48
- "aos",
49
- "array",
50
- "binary",
51
- "fuzzy",
52
- "search",
53
- "shuffle",
54
- "swizzle",
55
- "typescript"
56
- ],
57
- "publishConfig": {
58
- "access": "public"
59
- },
60
- "engines": {
61
- "node": ">=12.7"
62
- },
63
- "files": [
64
- "*.js",
65
- "*.d.ts"
66
- ],
67
- "exports": {
68
- ".": {
69
- "import": "./index.js"
70
- },
71
- "./api": {
72
- "import": "./api.js"
73
- },
74
- "./binary-search": {
75
- "import": "./binary-search.js"
76
- },
77
- "./bisect": {
78
- "import": "./bisect.js"
79
- },
80
- "./ends-with": {
81
- "import": "./ends-with.js"
82
- },
83
- "./ensure-array": {
84
- "import": "./ensure-array.js"
85
- },
86
- "./ensure-iterable": {
87
- "import": "./ensure-iterable.js"
88
- },
89
- "./fill-range": {
90
- "import": "./fill-range.js"
91
- },
92
- "./find": {
93
- "import": "./find.js"
94
- },
95
- "./fuzzy-match": {
96
- "import": "./fuzzy-match.js"
97
- },
98
- "./insert": {
99
- "import": "./insert.js"
100
- },
101
- "./into": {
102
- "import": "./into.js"
103
- },
104
- "./is-sorted": {
105
- "import": "./is-sorted.js"
106
- },
107
- "./iterator": {
108
- "import": "./iterator.js"
109
- },
110
- "./levenshtein": {
111
- "import": "./levenshtein.js"
112
- },
113
- "./peek": {
114
- "import": "./peek.js"
115
- },
116
- "./quicksort": {
117
- "import": "./quicksort.js"
118
- },
119
- "./shuffle": {
120
- "import": "./shuffle.js"
121
- },
122
- "./sort-cached": {
123
- "import": "./sort-cached.js"
124
- },
125
- "./starts-with": {
126
- "import": "./starts-with.js"
127
- },
128
- "./swap": {
129
- "import": "./swap.js"
130
- },
131
- "./swizzle": {
132
- "import": "./swizzle.js"
133
- }
134
- },
135
- "thi.ng": {
136
- "year": 2018
137
- },
138
- "gitHead": "c17a556ad25f6882dfa8f806a1d9e8ed7ac7cd71"
139
- }
2
+ "name": "@thi.ng/arrays",
3
+ "version": "2.1.1",
4
+ "description": "Array / Arraylike utilities",
5
+ "type": "module",
6
+ "module": "./index.js",
7
+ "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/thi-ng/umbrella.git"
12
+ },
13
+ "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/arrays#readme",
14
+ "funding": [
15
+ {
16
+ "type": "github",
17
+ "url": "https://github.com/sponsors/postspectacular"
18
+ },
19
+ {
20
+ "type": "patreon",
21
+ "url": "https://patreon.com/thing_umbrella"
22
+ }
23
+ ],
24
+ "author": "Karsten Schmidt <k+npm@thi.ng>",
25
+ "license": "Apache-2.0",
26
+ "scripts": {
27
+ "build": "yarn clean && tsc --declaration",
28
+ "clean": "rimraf '*.js' '*.d.ts' '*.map' doc",
29
+ "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
+ "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
31
+ "doc:readme": "yarn doc:stats && tools:readme",
32
+ "doc:stats": "tools:module-stats",
33
+ "pub": "yarn npm publish --access public",
34
+ "test": "testament test"
35
+ },
36
+ "dependencies": {
37
+ "@thi.ng/api": "^8.3.1",
38
+ "@thi.ng/checks": "^3.1.1",
39
+ "@thi.ng/compare": "^2.1.1",
40
+ "@thi.ng/equiv": "^2.1.1",
41
+ "@thi.ng/errors": "^2.1.1",
42
+ "@thi.ng/random": "^3.2.1"
43
+ },
44
+ "devDependencies": {
45
+ "@microsoft/api-extractor": "^7.18.19",
46
+ "@thi.ng/testament": "^0.2.1",
47
+ "rimraf": "^3.0.2",
48
+ "tools": "^0.0.1",
49
+ "typedoc": "^0.22.9",
50
+ "typescript": "^4.5.2"
51
+ },
52
+ "keywords": [
53
+ "aos",
54
+ "array",
55
+ "binary",
56
+ "fuzzy",
57
+ "search",
58
+ "shuffle",
59
+ "swizzle",
60
+ "typescript"
61
+ ],
62
+ "publishConfig": {
63
+ "access": "public"
64
+ },
65
+ "engines": {
66
+ "node": ">=12.7"
67
+ },
68
+ "files": [
69
+ "*.js",
70
+ "*.d.ts"
71
+ ],
72
+ "exports": {
73
+ ".": {
74
+ "import": "./index.js"
75
+ },
76
+ "./api": {
77
+ "import": "./api.js"
78
+ },
79
+ "./binary-search": {
80
+ "import": "./binary-search.js"
81
+ },
82
+ "./bisect": {
83
+ "import": "./bisect.js"
84
+ },
85
+ "./ends-with": {
86
+ "import": "./ends-with.js"
87
+ },
88
+ "./ensure-array": {
89
+ "import": "./ensure-array.js"
90
+ },
91
+ "./ensure-iterable": {
92
+ "import": "./ensure-iterable.js"
93
+ },
94
+ "./fill-range": {
95
+ "import": "./fill-range.js"
96
+ },
97
+ "./find": {
98
+ "import": "./find.js"
99
+ },
100
+ "./fuzzy-match": {
101
+ "import": "./fuzzy-match.js"
102
+ },
103
+ "./insert": {
104
+ "import": "./insert.js"
105
+ },
106
+ "./into": {
107
+ "import": "./into.js"
108
+ },
109
+ "./is-sorted": {
110
+ "import": "./is-sorted.js"
111
+ },
112
+ "./iterator": {
113
+ "import": "./iterator.js"
114
+ },
115
+ "./levenshtein": {
116
+ "import": "./levenshtein.js"
117
+ },
118
+ "./peek": {
119
+ "import": "./peek.js"
120
+ },
121
+ "./quicksort": {
122
+ "import": "./quicksort.js"
123
+ },
124
+ "./shuffle": {
125
+ "import": "./shuffle.js"
126
+ },
127
+ "./sort-cached": {
128
+ "import": "./sort-cached.js"
129
+ },
130
+ "./starts-with": {
131
+ "import": "./starts-with.js"
132
+ },
133
+ "./swap": {
134
+ "import": "./swap.js"
135
+ },
136
+ "./swizzle": {
137
+ "import": "./swizzle.js"
138
+ }
139
+ },
140
+ "thi.ng": {
141
+ "year": 2018
142
+ },
143
+ "gitHead": "8bd27c8bde0b770e7c001943f11c951cd345d668\n"
144
+ }
package/shuffle.js CHANGED
@@ -19,7 +19,7 @@ export const shuffleRange = (buf, start = 0, end = buf.length, rnd = SYSTEM) =>
19
19
  let n = end - start;
20
20
  const l = n;
21
21
  if (l > 1) {
22
- while (--n >= 0) {
22
+ while (n-- > 0) {
23
23
  const a = (start + rnd.float(l)) | 0;
24
24
  const b = (start + rnd.float(l)) | 0;
25
25
  const t = buf[a];
package/swap.js CHANGED
@@ -66,7 +66,7 @@ export const multiSwap = (...xs) => {
66
66
  default:
67
67
  return (a, x, y) => {
68
68
  swap(a, x, y);
69
- for (let i = n; --i >= 0;)
69
+ for (let i = n; i-- > 0;)
70
70
  swap(xs[i], x, y);
71
71
  };
72
72
  }
package/swizzle.js CHANGED
@@ -47,7 +47,7 @@ export const swizzle = (order) => {
47
47
  default:
48
48
  return (x) => {
49
49
  const res = [];
50
- for (let i = order.length; --i >= 0;) {
50
+ for (let i = order.length; i-- > 0;) {
51
51
  res[i] = x[order[i]];
52
52
  }
53
53
  return res;