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