@thi.ng/strings 3.1.2 → 3.2.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 +211 -158
- package/README.md +1 -1
- package/package.json +200 -195
- package/units.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,298 +1,351 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## [3.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@3.1.1...@thi.ng/strings@3.1.2) (2021-10-28)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @thi.ng/strings
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## [3.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@3.1.0...@thi.ng/strings@3.1.1) (2021-10-28)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @thi.ng/strings
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [3.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@3.0.3...@thi.ng/strings@3.1.0) (2021-10-25)
|
|
3
|
+
- **Last updated**: 2021-11-19T07:59:51Z
|
|
4
|
+
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
23
5
|
|
|
6
|
+
All notable changes to this project will be documented in this file.
|
|
7
|
+
See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
|
|
24
8
|
|
|
25
|
-
|
|
9
|
+
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
|
+
and/or version bumps of transitive dependencies.
|
|
26
11
|
|
|
27
|
-
|
|
12
|
+
## [3.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.2.0) (2021-11-17)
|
|
28
13
|
|
|
14
|
+
#### 🚀 Features
|
|
29
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
|
|
30
21
|
|
|
22
|
+
#### ♻️ Refactoring
|
|
31
23
|
|
|
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.
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
### [3.1.4](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.1.4) (2021-11-10)
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
#### ♻️ Refactoring
|
|
36
34
|
|
|
35
|
+
- update all countdown loops ([a5f374b](https://github.com/thi-ng/umbrella/commit/a5f374b))
|
|
37
36
|
|
|
37
|
+
## [3.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.1.0) (2021-10-25)
|
|
38
38
|
|
|
39
|
+
#### 🚀 Features
|
|
39
40
|
|
|
41
|
+
- migrate/add entities, regexes, fns ([57c246d](https://github.com/thi-ng/umbrella/commit/57c246d))
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
### [3.0.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.0.1) (2021-10-13)
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
#### ♻️ Refactoring
|
|
44
46
|
|
|
47
|
+
- update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
|
|
48
|
+
- update imports in all pkgs ([5fa2b6f](https://github.com/thi-ng/umbrella/commit/5fa2b6f))
|
|
49
|
+
- add .js suffix for all relative imports
|
|
45
50
|
|
|
51
|
+
# [3.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.0.0) (2021-10-12)
|
|
46
52
|
|
|
53
|
+
#### 🛑 Breaking changes
|
|
47
54
|
|
|
55
|
+
- major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea))
|
|
56
|
+
- BREAKING CHANGE: discontinue CommonJS & UMD versions
|
|
57
|
+
- only ESM modules will be published from now on
|
|
58
|
+
- CJS obsolete due to ESM support in recent versions of node:
|
|
59
|
+
- i.e. launch NodeJS via:
|
|
60
|
+
- `node --experimental-specifier-resolution=node --experimental-repl-await`
|
|
61
|
+
- in the node REPL use `await import(...)` instead of `require()`
|
|
62
|
+
- UMD obsolete due to widespread browser support for ESM
|
|
63
|
+
Also:
|
|
64
|
+
- normalize/restructure/reorg all package.json files
|
|
65
|
+
- cleanup all build scripts, remove obsolete
|
|
66
|
+
- switch from mocha to [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament) for all tests
|
|
48
67
|
|
|
49
|
-
|
|
68
|
+
#### 🚀 Features
|
|
50
69
|
|
|
51
|
-
|
|
70
|
+
- add initials() ([5b8476f](https://github.com/thi-ng/umbrella/commit/5b8476f))
|
|
52
71
|
|
|
72
|
+
#### ♻️ Refactoring
|
|
53
73
|
|
|
74
|
+
- update imports ([138571a](https://github.com/thi-ng/umbrella/commit/138571a))
|
|
75
|
+
- update all tests in _all_ pkgs ([8b582bc](https://github.com/thi-ng/umbrella/commit/8b582bc))
|
|
76
|
+
- update all to use [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament)
|
|
54
77
|
|
|
78
|
+
## [2.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@2.1.0) (2021-03-24)
|
|
55
79
|
|
|
80
|
+
#### 🚀 Features
|
|
56
81
|
|
|
57
|
-
|
|
82
|
+
- add ruler(), grid() fns, update readme ([d93cbf9](https://github.com/thi-ng/umbrella/commit/d93cbf9))
|
|
58
83
|
|
|
84
|
+
#### ♻️ Refactoring
|
|
59
85
|
|
|
60
|
-
|
|
86
|
+
- update opts default handling ([fc92745](https://github.com/thi-ng/umbrella/commit/fc92745))
|
|
87
|
+
- update wrapWord(), wordWrapLine()
|
|
61
88
|
|
|
62
|
-
|
|
89
|
+
# [2.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@2.0.0) (2021-03-24)
|
|
63
90
|
|
|
91
|
+
#### 🛑 Breaking changes
|
|
64
92
|
|
|
65
|
-
|
|
93
|
+
- major update wordWrap() & co. ([9c9c9cc](https://github.com/thi-ng/umbrella/commit/9c9c9cc))
|
|
94
|
+
- BREAKING CHANGE: major update wordWrap(), wordWrapLines() etc.
|
|
95
|
+
- update arguments
|
|
96
|
+
- add `WordWrapOpts` to configure wordwrap behavior
|
|
97
|
+
- add `IWordSplit` interface and `SPLIT_PLAIN`, `SPLIT_ANSI` impls
|
|
98
|
+
- implement hardwrap mode
|
|
66
99
|
|
|
67
|
-
|
|
100
|
+
#### 🚀 Features
|
|
68
101
|
|
|
102
|
+
- add ANSI predicates ([928694b](https://github.com/thi-ng/umbrella/commit/928694b))
|
|
103
|
+
- update split() args ([ea503e8](https://github.com/thi-ng/umbrella/commit/ea503e8))
|
|
104
|
+
- allow string delimiters (or regexp)
|
|
69
105
|
|
|
70
|
-
|
|
106
|
+
## [1.15.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.15.0) (2021-02-20)
|
|
71
107
|
|
|
72
|
-
|
|
108
|
+
#### 🚀 Features
|
|
73
109
|
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
- i.e. launch NodeJS via:
|
|
77
|
-
- `node --experimental-specifier-resolution=node --experimental-repl-await`
|
|
78
|
-
- in the node REPL use `await import(...)` instead of `require()`
|
|
79
|
-
- UMD obsolete due to widespread browser support for ESM
|
|
110
|
+
- add int/intLocale, vector formatters ([ac55fe0](https://github.com/thi-ng/umbrella/commit/ac55fe0))
|
|
111
|
+
- add optional arg for float() for special NaN/Inf handling
|
|
80
112
|
|
|
81
|
-
|
|
82
|
-
- normalize/restructure/reorg all package.json files
|
|
83
|
-
- cleanup all build scripts, remove obsolete
|
|
84
|
-
- switch from mocha to @thi.ng/testament for all tests
|
|
113
|
+
#### ♻️ Refactoring
|
|
85
114
|
|
|
115
|
+
- avoid [@thi.ng/checks](https://github.com/thi-ng/umbrella/tree/main/packages/checks) dep in vector() ([410d463](https://github.com/thi-ng/umbrella/commit/410d463))
|
|
116
|
+
- update uuid() ([7fe966a](https://github.com/thi-ng/umbrella/commit/7fe966a))
|
|
117
|
+
- re-use fn from [@thi.ng/hex](https://github.com/thi-ng/umbrella/tree/main/packages/hex)
|
|
86
118
|
|
|
119
|
+
## [1.14.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.14.0) (2021-01-13)
|
|
87
120
|
|
|
121
|
+
#### 🚀 Features
|
|
88
122
|
|
|
123
|
+
- add stringify() HOF ([4ab7e72](https://github.com/thi-ng/umbrella/commit/4ab7e72))
|
|
89
124
|
|
|
125
|
+
#### ♻️ Refactoring
|
|
90
126
|
|
|
91
|
-
|
|
127
|
+
- minor update computeCursorPos() ([a593d66](https://github.com/thi-ng/umbrella/commit/a593d66))
|
|
128
|
+
- minor update uuid() ([0a37562](https://github.com/thi-ng/umbrella/commit/0a37562))
|
|
92
129
|
|
|
93
|
-
|
|
130
|
+
## [1.13.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.13.0) (2021-01-10)
|
|
94
131
|
|
|
95
|
-
|
|
132
|
+
#### 🚀 Features
|
|
96
133
|
|
|
97
|
-
|
|
134
|
+
- add tab conversion fns ([aefdd97](https://github.com/thi-ng/umbrella/commit/aefdd97))
|
|
135
|
+
- add wordWrap*() fns ([2a283c0](https://github.com/thi-ng/umbrella/commit/2a283c0))
|
|
136
|
+
- add stripAnsi(), lengthAnsi() fns ([86fa81a](https://github.com/thi-ng/umbrella/commit/86fa81a))
|
|
137
|
+
- update padLeft/Right() args ([118f97f](https://github.com/thi-ng/umbrella/commit/118f97f))
|
|
138
|
+
- add optional length arg to explicitly specify string length
|
|
139
|
+
(e.g. to exclude ANSI control seq chars)
|
|
98
140
|
|
|
99
|
-
|
|
141
|
+
#### ⏱ Performance improvements
|
|
100
142
|
|
|
101
|
-
-
|
|
102
|
-
- **strings:** major update wordWrap() & co. ([9c9c9cc](https://github.com/thi-ng/umbrella/commit/9c9c9cc1abe68ec32edbe91ac5c277561cafd3c4))
|
|
103
|
-
- **strings:** update split() args ([ea503e8](https://github.com/thi-ng/umbrella/commit/ea503e8abdf3598ccd0c1abf5d484164ea73890c))
|
|
143
|
+
- simplify string default delim regexp ([bb62760](https://github.com/thi-ng/umbrella/commit/bb62760))
|
|
104
144
|
|
|
105
|
-
|
|
145
|
+
## [1.12.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.12.0) (2021-01-05)
|
|
106
146
|
|
|
107
|
-
|
|
108
|
-
- update arguments
|
|
109
|
-
- add `WordWrapOpts` to configure wordwrap behavior
|
|
110
|
-
- add `IWordSplit` interface and `SPLIT_PLAIN`, `SPLIT_ANSI` impls
|
|
111
|
-
- implement hardwrap mode
|
|
147
|
+
#### 🚀 Features
|
|
112
148
|
|
|
113
|
-
|
|
149
|
+
- add interpolateKeys() ([bd78d1d](https://github.com/thi-ng/umbrella/commit/bd78d1d))
|
|
114
150
|
|
|
115
|
-
###
|
|
151
|
+
### [1.11.4](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.11.4) (2021-01-02)
|
|
116
152
|
|
|
117
|
-
|
|
153
|
+
#### 🩹 Bug fixes
|
|
118
154
|
|
|
119
|
-
#
|
|
155
|
+
- update slugifyGH() replacements ([#174](https://github.com/thi-ng/umbrella/issues/174)) ([98a9135](https://github.com/thi-ng/umbrella/commit/98a9135))
|
|
156
|
+
- hard to find definitive info about GH's slugify rules
|
|
157
|
+
- new rules based on more manual experiments and
|
|
158
|
+
studying of unicode charts
|
|
159
|
+
- likely not a watertight solution, but should fix most issues
|
|
160
|
+
of prev impl
|
|
120
161
|
|
|
121
|
-
###
|
|
162
|
+
### [1.11.2](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.11.2) (2020-12-07)
|
|
122
163
|
|
|
123
|
-
|
|
164
|
+
#### ♻️ Refactoring
|
|
124
165
|
|
|
125
|
-
|
|
166
|
+
- update type-only imports in various tests/pkgs ([3fd9c24](https://github.com/thi-ng/umbrella/commit/3fd9c24))
|
|
126
167
|
|
|
127
|
-
|
|
168
|
+
## [1.11.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.11.0) (2020-11-24)
|
|
128
169
|
|
|
129
|
-
|
|
130
|
-
- **strings:** add tab conversion fns ([aefdd97](https://github.com/thi-ng/umbrella/commit/aefdd97e27fce2405860e817b9c5b4aedb6e59e4))
|
|
131
|
-
- **strings:** add wordWrap*() fns ([2a283c0](https://github.com/thi-ng/umbrella/commit/2a283c018592d8cc76f4ef83b69c6ce3c378aca6))
|
|
132
|
-
- **strings:** update padLeft/Right() args ([118f97f](https://github.com/thi-ng/umbrella/commit/118f97f1fca27671c53d184484a7b435e6eedf88))
|
|
170
|
+
#### 🚀 Features
|
|
133
171
|
|
|
134
|
-
|
|
172
|
+
- add split() iterator ([6d2ec4f](https://github.com/thi-ng/umbrella/commit/6d2ec4f))
|
|
135
173
|
|
|
136
|
-
|
|
174
|
+
#### ♻️ Refactoring
|
|
137
175
|
|
|
138
|
-
|
|
176
|
+
- replace hex formatters w/ [@thi.ng/hex](https://github.com/thi-ng/umbrella/tree/main/packages/hex) ([6d7446c](https://github.com/thi-ng/umbrella/commit/6d7446c))
|
|
177
|
+
- add [@thi.ng/hex](https://github.com/thi-ng/umbrella/tree/main/packages/hex) dependency
|
|
178
|
+
- replace U8/16/24/32/64
|
|
179
|
+
- refactor uuid()
|
|
139
180
|
|
|
140
|
-
|
|
181
|
+
## [1.10.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.10.0) (2020-09-22)
|
|
141
182
|
|
|
142
|
-
|
|
183
|
+
#### 🚀 Features
|
|
143
184
|
|
|
144
|
-
|
|
185
|
+
- add BOM const, update pkg meta ([b6751fc](https://github.com/thi-ng/umbrella/commit/b6751fc))
|
|
186
|
+
- add escape(), update unescape(), add tests ([e0d5f1e](https://github.com/thi-ng/umbrella/commit/e0d5f1e))
|
|
187
|
+
- add unescape() ([924466b](https://github.com/thi-ng/umbrella/commit/924466b))
|
|
145
188
|
|
|
146
|
-
###
|
|
189
|
+
### [1.9.6](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.9.6) (2020-09-13)
|
|
147
190
|
|
|
148
|
-
|
|
191
|
+
#### ♻️ Refactoring
|
|
149
192
|
|
|
150
|
-
|
|
193
|
+
- update deps, imports, use new Fn types ([3d21571](https://github.com/thi-ng/umbrella/commit/3d21571))
|
|
151
194
|
|
|
152
|
-
|
|
195
|
+
## [1.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.9.0) (2020-07-08)
|
|
153
196
|
|
|
154
|
-
|
|
197
|
+
#### 🚀 Features
|
|
155
198
|
|
|
156
|
-
|
|
199
|
+
- add computeCursorPos() ([c178d00](https://github.com/thi-ng/umbrella/commit/c178d00))
|
|
157
200
|
|
|
158
|
-
###
|
|
201
|
+
### [1.8.4](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.8.4) (2020-04-20)
|
|
159
202
|
|
|
160
|
-
|
|
161
|
-
- **strings:** add escape(), update unescape(), add tests ([e0d5f1e](https://github.com/thi-ng/umbrella/commit/e0d5f1edcdf78b075908c4973586a0f1732fe006))
|
|
162
|
-
- **strings:** add unescape() ([924466b](https://github.com/thi-ng/umbrella/commit/924466bc5d5f16ced3da95fa2f24dab2bfad0679))
|
|
203
|
+
#### ♻️ Refactoring
|
|
163
204
|
|
|
164
|
-
|
|
205
|
+
- update ALPHA, ALPHA_NUM & WS groups ([719b437](https://github.com/thi-ng/umbrella/commit/719b437))
|
|
165
206
|
|
|
166
|
-
|
|
207
|
+
## [1.8.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.8.0) (2020-03-28)
|
|
167
208
|
|
|
168
|
-
|
|
209
|
+
#### 🚀 Features
|
|
169
210
|
|
|
170
|
-
|
|
211
|
+
- add trim() HOF ([350a6c6](https://github.com/thi-ng/umbrella/commit/350a6c6))
|
|
212
|
+
- add slugifyGH(), refactor slugify() ([1ef805b](https://github.com/thi-ng/umbrella/commit/1ef805b))
|
|
213
|
+
- add join() HOF ([1c5c46f](https://github.com/thi-ng/umbrella/commit/1c5c46f))
|
|
171
214
|
|
|
172
|
-
|
|
215
|
+
#### ♻️ Refactoring
|
|
173
216
|
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
- **strings:** add trim() HOF ([350a6c6](https://github.com/thi-ng/umbrella/commit/350a6c6cb010e00f2053fb41eeb0f458ee8fb715))
|
|
217
|
+
- update bits/bytes unit defs ([f9becb1](https://github.com/thi-ng/umbrella/commit/f9becb1))
|
|
218
|
+
- add truncateRight alias ([81fb592](https://github.com/thi-ng/umbrella/commit/81fb592))
|
|
177
219
|
|
|
178
|
-
|
|
220
|
+
## [1.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.7.0) (2020-03-06)
|
|
179
221
|
|
|
180
|
-
|
|
222
|
+
#### 🚀 Features
|
|
181
223
|
|
|
182
|
-
-
|
|
224
|
+
- add char group LUTs for classification ([c3ff006](https://github.com/thi-ng/umbrella/commit/c3ff006))
|
|
183
225
|
|
|
184
|
-
|
|
226
|
+
## [1.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.6.0) (2020-03-01)
|
|
185
227
|
|
|
186
|
-
|
|
228
|
+
#### 🚀 Features
|
|
187
229
|
|
|
188
|
-
-
|
|
230
|
+
- add defFormat() HOF ([62f4e04](https://github.com/thi-ng/umbrella/commit/62f4e04))
|
|
189
231
|
|
|
190
|
-
|
|
232
|
+
## [1.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.5.0) (2020-02-25)
|
|
191
233
|
|
|
192
|
-
|
|
234
|
+
#### 🚀 Features
|
|
193
235
|
|
|
194
|
-
-
|
|
236
|
+
- add uuid() formatter ([4592742](https://github.com/thi-ng/umbrella/commit/4592742))
|
|
195
237
|
|
|
196
|
-
|
|
238
|
+
#### ♻️ Refactoring
|
|
197
239
|
|
|
198
|
-
|
|
240
|
+
- update imports ([3937dc6](https://github.com/thi-ng/umbrella/commit/3937dc6))
|
|
199
241
|
|
|
200
|
-
|
|
201
|
-
- **strings:** add interpolate() ([a19e409](https://github.com/thi-ng/umbrella/commit/a19e4094494a8b4af6c35626e4a99394e0481a4e))
|
|
242
|
+
## [1.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.4.0) (2020-01-26)
|
|
202
243
|
|
|
203
|
-
|
|
244
|
+
#### 🚀 Features
|
|
204
245
|
|
|
205
|
-
|
|
246
|
+
- add interpolate() ([a19e409](https://github.com/thi-ng/umbrella/commit/a19e409))
|
|
247
|
+
- add format() helpers (str, ignore) ([df87b7c](https://github.com/thi-ng/umbrella/commit/df87b7c))
|
|
206
248
|
|
|
207
|
-
|
|
249
|
+
## [1.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.3.0) (2019-09-21)
|
|
208
250
|
|
|
209
|
-
|
|
251
|
+
#### 🚀 Features
|
|
210
252
|
|
|
211
|
-
|
|
253
|
+
- add charRange(), add radix & zero-pad presets ([c9e5a63](https://github.com/thi-ng/umbrella/commit/c9e5a63))
|
|
212
254
|
|
|
213
|
-
|
|
255
|
+
## [1.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.2.0) (2019-07-07)
|
|
214
256
|
|
|
215
|
-
|
|
257
|
+
#### 🚀 Features
|
|
216
258
|
|
|
217
|
-
|
|
259
|
+
- enable TS strict compiler flags (refactor) ([76cecb8](https://github.com/thi-ng/umbrella/commit/76cecb8))
|
|
218
260
|
|
|
219
|
-
|
|
261
|
+
#### ♻️ Refactoring
|
|
220
262
|
|
|
221
|
-
|
|
263
|
+
- address TS strictNullChecks flag ([fb315fe](https://github.com/thi-ng/umbrella/commit/fb315fe))
|
|
222
264
|
|
|
223
|
-
|
|
265
|
+
## [1.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.1.0) (2019-04-15)
|
|
224
266
|
|
|
225
|
-
|
|
267
|
+
#### 🚀 Features
|
|
226
268
|
|
|
227
|
-
|
|
269
|
+
- add hstr() (hollerith) ([619e9ef](https://github.com/thi-ng/umbrella/commit/619e9ef))
|
|
228
270
|
|
|
229
|
-
###
|
|
271
|
+
### [1.0.2](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.0.2) (2019-01-31)
|
|
230
272
|
|
|
231
|
-
|
|
273
|
+
#### 🩹 Bug fixes
|
|
232
274
|
|
|
233
|
-
|
|
275
|
+
- fix [#70](https://github.com/thi-ng/umbrella/issues/70), replace kebab() regex w/ legacy version ([3adabc4](https://github.com/thi-ng/umbrella/commit/3adabc4))
|
|
234
276
|
|
|
235
|
-
|
|
277
|
+
# [1.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@1.0.0) (2019-01-21)
|
|
236
278
|
|
|
237
|
-
|
|
279
|
+
#### 🛑 Breaking changes
|
|
238
280
|
|
|
239
|
-
-
|
|
240
|
-
-
|
|
241
|
-
-
|
|
281
|
+
- update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
|
|
282
|
+
- BREAKING CHANGE: enabled multi-outputs (ES6 modules, CJS, UMD)
|
|
283
|
+
- build scripts now first build ES6 modules in package root, then call
|
|
284
|
+
`scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
|
|
285
|
+
- all imports MUST be updated to only refer to package level
|
|
286
|
+
(not individual files anymore). tree shaking in user land will get rid of
|
|
287
|
+
all unused imported symbols.
|
|
242
288
|
|
|
243
|
-
|
|
289
|
+
## [0.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@0.7.0) (2018-12-13)
|
|
244
290
|
|
|
245
|
-
|
|
291
|
+
#### 🚀 Features
|
|
246
292
|
|
|
247
|
-
-
|
|
293
|
+
- add slugify() ([8dcc73a](https://github.com/thi-ng/umbrella/commit/8dcc73a))
|
|
248
294
|
|
|
249
|
-
|
|
295
|
+
#### 🩹 Bug fixes
|
|
250
296
|
|
|
251
|
-
-
|
|
297
|
+
- update kebab() ([1b298f7](https://github.com/thi-ng/umbrella/commit/1b298f7))
|
|
298
|
+
- fix initial capital handling
|
|
299
|
+
- add (partial) UTF-8 support
|
|
300
|
+
- add note about Safari / FF
|
|
252
301
|
|
|
253
|
-
|
|
302
|
+
## [0.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@0.6.0) (2018-11-08)
|
|
254
303
|
|
|
255
|
-
|
|
304
|
+
#### 🚀 Features
|
|
256
305
|
|
|
257
|
-
-
|
|
306
|
+
- add configurable units() HOF & presets ([33e915b](https://github.com/thi-ng/umbrella/commit/33e915b))
|
|
307
|
+
- add presets formatters: seconds(), meters(), grams(), bits(), bytes()
|
|
258
308
|
|
|
259
|
-
|
|
309
|
+
## [0.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@0.5.0) (2018-09-25)
|
|
260
310
|
|
|
261
|
-
|
|
311
|
+
#### 🚀 Features
|
|
262
312
|
|
|
263
|
-
-
|
|
313
|
+
- add splice(), refactor repeat(), add tests ([0cce048](https://github.com/thi-ng/umbrella/commit/0cce048))
|
|
264
314
|
|
|
265
|
-
|
|
315
|
+
### [0.4.3](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@0.4.3) (2018-09-24)
|
|
266
316
|
|
|
267
|
-
|
|
317
|
+
#### 🩹 Bug fixes
|
|
268
318
|
|
|
269
|
-
-
|
|
319
|
+
- rename number parsers ([8cbfb97](https://github.com/thi-ng/umbrella/commit/8cbfb97))
|
|
320
|
+
- rename to `maybeParseInt` / `maybeParseFloat`
|
|
270
321
|
|
|
271
|
-
|
|
322
|
+
## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@0.3.0) (2018-08-24)
|
|
272
323
|
|
|
273
|
-
|
|
324
|
+
#### 🚀 Features
|
|
274
325
|
|
|
275
|
-
-
|
|
326
|
+
- add case converters ([653a175](https://github.com/thi-ng/umbrella/commit/653a175))
|
|
327
|
+
- camel / kebab / snake
|
|
328
|
+
- add truncateLeft() & wrap() stringers ([1a20bc2](https://github.com/thi-ng/umbrella/commit/1a20bc2))
|
|
276
329
|
|
|
277
|
-
|
|
330
|
+
#### 🩹 Bug fixes
|
|
278
331
|
|
|
279
|
-
-
|
|
280
|
-
-
|
|
332
|
+
- buffer length (for null inputs) (`center()`) ([5209c42](https://github.com/thi-ng/umbrella/commit/5209c42))
|
|
333
|
+
- also truncate oversized inputs
|
|
281
334
|
|
|
282
|
-
|
|
335
|
+
## [0.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@0.2.0) (2018-08-08)
|
|
283
336
|
|
|
284
|
-
|
|
337
|
+
#### 🚀 Features
|
|
285
338
|
|
|
286
|
-
-
|
|
339
|
+
- add opt prefix arg for radix() ([5864f2c](https://github.com/thi-ng/umbrella/commit/5864f2c))
|
|
287
340
|
|
|
288
|
-
|
|
341
|
+
### [0.1.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@0.1.1) (2018-08-08)
|
|
289
342
|
|
|
290
|
-
|
|
343
|
+
#### 🩹 Bug fixes
|
|
291
344
|
|
|
292
|
-
-
|
|
345
|
+
- float type decl ([b2ebbfc](https://github.com/thi-ng/umbrella/commit/b2ebbfc))
|
|
293
346
|
|
|
294
|
-
|
|
347
|
+
## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@0.1.0) (2018-08-08)
|
|
295
348
|
|
|
296
|
-
|
|
349
|
+
#### 🚀 Features
|
|
297
350
|
|
|
298
|
-
-
|
|
351
|
+
- re-import & update [@thi.ng/strings](https://github.com/thi-ng/umbrella/tree/main/packages/strings) from MBP2010 ([40781eb](https://github.com/thi-ng/umbrella/commit/40781eb))
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,196 +1,201 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
2
|
+
"name": "@thi.ng/strings",
|
|
3
|
+
"version": "3.2.1",
|
|
4
|
+
"description": "Various string formatting & utility functions",
|
|
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/format#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/errors": "^2.1.1",
|
|
39
|
+
"@thi.ng/hex": "^2.1.1",
|
|
40
|
+
"@thi.ng/memoize": "^3.1.1"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@microsoft/api-extractor": "^7.18.19",
|
|
44
|
+
"@thi.ng/testament": "^0.2.1",
|
|
45
|
+
"rimraf": "^3.0.2",
|
|
46
|
+
"tools": "^0.0.1",
|
|
47
|
+
"typedoc": "^0.22.9",
|
|
48
|
+
"typescript": "^4.5.2"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"ansi",
|
|
52
|
+
"composition",
|
|
53
|
+
"conversion",
|
|
54
|
+
"escape",
|
|
55
|
+
"float",
|
|
56
|
+
"format",
|
|
57
|
+
"functional",
|
|
58
|
+
"hex",
|
|
59
|
+
"hollerith",
|
|
60
|
+
"interpolation",
|
|
61
|
+
"number",
|
|
62
|
+
"padding",
|
|
63
|
+
"percent",
|
|
64
|
+
"radix",
|
|
65
|
+
"slugify",
|
|
66
|
+
"split",
|
|
67
|
+
"string",
|
|
68
|
+
"tab",
|
|
69
|
+
"trim",
|
|
70
|
+
"typescript",
|
|
71
|
+
"unicode",
|
|
72
|
+
"wordwrap"
|
|
73
|
+
],
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
},
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": ">=12.7"
|
|
79
|
+
},
|
|
80
|
+
"files": [
|
|
81
|
+
"*.js",
|
|
82
|
+
"*.d.ts"
|
|
83
|
+
],
|
|
84
|
+
"exports": {
|
|
85
|
+
".": {
|
|
86
|
+
"import": "./index.js"
|
|
87
|
+
},
|
|
88
|
+
"./ansi": {
|
|
89
|
+
"import": "./ansi.js"
|
|
90
|
+
},
|
|
91
|
+
"./api": {
|
|
92
|
+
"import": "./api.js"
|
|
93
|
+
},
|
|
94
|
+
"./case": {
|
|
95
|
+
"import": "./case.js"
|
|
96
|
+
},
|
|
97
|
+
"./center": {
|
|
98
|
+
"import": "./center.js"
|
|
99
|
+
},
|
|
100
|
+
"./cursor": {
|
|
101
|
+
"import": "./cursor.js"
|
|
102
|
+
},
|
|
103
|
+
"./entities": {
|
|
104
|
+
"import": "./entities.js"
|
|
105
|
+
},
|
|
106
|
+
"./escape": {
|
|
107
|
+
"import": "./escape.js"
|
|
108
|
+
},
|
|
109
|
+
"./float": {
|
|
110
|
+
"import": "./float.js"
|
|
111
|
+
},
|
|
112
|
+
"./format": {
|
|
113
|
+
"import": "./format.js"
|
|
114
|
+
},
|
|
115
|
+
"./groups": {
|
|
116
|
+
"import": "./groups.js"
|
|
117
|
+
},
|
|
118
|
+
"./hollerith": {
|
|
119
|
+
"import": "./hollerith.js"
|
|
120
|
+
},
|
|
121
|
+
"./initials": {
|
|
122
|
+
"import": "./initials.js"
|
|
123
|
+
},
|
|
124
|
+
"./int": {
|
|
125
|
+
"import": "./int.js"
|
|
126
|
+
},
|
|
127
|
+
"./interpolate": {
|
|
128
|
+
"import": "./interpolate.js"
|
|
129
|
+
},
|
|
130
|
+
"./join": {
|
|
131
|
+
"import": "./join.js"
|
|
132
|
+
},
|
|
133
|
+
"./pad-left": {
|
|
134
|
+
"import": "./pad-left.js"
|
|
135
|
+
},
|
|
136
|
+
"./pad-right": {
|
|
137
|
+
"import": "./pad-right.js"
|
|
138
|
+
},
|
|
139
|
+
"./parse": {
|
|
140
|
+
"import": "./parse.js"
|
|
141
|
+
},
|
|
142
|
+
"./percent": {
|
|
143
|
+
"import": "./percent.js"
|
|
144
|
+
},
|
|
145
|
+
"./radix": {
|
|
146
|
+
"import": "./radix.js"
|
|
147
|
+
},
|
|
148
|
+
"./range": {
|
|
149
|
+
"import": "./range.js"
|
|
150
|
+
},
|
|
151
|
+
"./repeat": {
|
|
152
|
+
"import": "./repeat.js"
|
|
153
|
+
},
|
|
154
|
+
"./ruler": {
|
|
155
|
+
"import": "./ruler.js"
|
|
156
|
+
},
|
|
157
|
+
"./slugify": {
|
|
158
|
+
"import": "./slugify.js"
|
|
159
|
+
},
|
|
160
|
+
"./splice": {
|
|
161
|
+
"import": "./splice.js"
|
|
162
|
+
},
|
|
163
|
+
"./split": {
|
|
164
|
+
"import": "./split.js"
|
|
165
|
+
},
|
|
166
|
+
"./stringify": {
|
|
167
|
+
"import": "./stringify.js"
|
|
168
|
+
},
|
|
169
|
+
"./tabs": {
|
|
170
|
+
"import": "./tabs.js"
|
|
171
|
+
},
|
|
172
|
+
"./trim": {
|
|
173
|
+
"import": "./trim.js"
|
|
174
|
+
},
|
|
175
|
+
"./truncate-left": {
|
|
176
|
+
"import": "./truncate-left.js"
|
|
177
|
+
},
|
|
178
|
+
"./truncate": {
|
|
179
|
+
"import": "./truncate.js"
|
|
180
|
+
},
|
|
181
|
+
"./units": {
|
|
182
|
+
"import": "./units.js"
|
|
183
|
+
},
|
|
184
|
+
"./uuid": {
|
|
185
|
+
"import": "./uuid.js"
|
|
186
|
+
},
|
|
187
|
+
"./vector": {
|
|
188
|
+
"import": "./vector.js"
|
|
189
|
+
},
|
|
190
|
+
"./word-wrap": {
|
|
191
|
+
"import": "./word-wrap.js"
|
|
192
|
+
},
|
|
193
|
+
"./wrap": {
|
|
194
|
+
"import": "./wrap.js"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"thi.ng": {
|
|
198
|
+
"year": 2015
|
|
199
|
+
},
|
|
200
|
+
"gitHead": "8bd27c8bde0b770e7c001943f11c951cd345d668\n"
|
|
201
|
+
}
|
package/units.js
CHANGED
|
@@ -12,7 +12,7 @@ export const units = memoizeJ((exp, base, prec = 2) => {
|
|
|
12
12
|
return `0${base}`;
|
|
13
13
|
}
|
|
14
14
|
const absX = Math.abs(x);
|
|
15
|
-
for (let i = groups.length; --
|
|
15
|
+
for (let i = groups.length; i-- > 0;) {
|
|
16
16
|
const g = groups[i];
|
|
17
17
|
if (absX >= g[0] || i === 0) {
|
|
18
18
|
return (x / g[0]).toFixed(g[1]) + g[2];
|