@thi.ng/strings 2.1.7 → 3.0.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 +128 -185
- package/README.md +13 -5
- package/center.js +1 -1
- package/float.js +1 -1
- package/groups.js +6 -2
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/initials.d.ts +22 -0
- package/initials.js +28 -0
- package/int.js +1 -1
- package/interpolate.js +1 -1
- package/join.js +1 -1
- package/package.json +132 -25
- package/pad-left.js +1 -1
- package/pad-right.js +1 -1
- package/radix.js +1 -1
- package/repeat.js +1 -1
- package/splice.js +1 -1
- package/trim.js +1 -1
- package/truncate-left.js +4 -2
- package/truncate.js +1 -1
- package/units.js +1 -1
- package/vector.js +1 -1
- package/word-wrap.js +9 -3
- package/wrap.js +1 -1
- package/lib/index.js +0 -630
- package/lib/index.js.map +0 -1
- package/lib/index.umd.js +0 -1
- package/lib/index.umd.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,302 +3,245 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @thi.ng/strings
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@2.0.0...@thi.ng/strings@2.1.0) (2021-03-24)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### Features
|
|
18
|
-
|
|
19
|
-
* **strings:** add ruler(), grid() fns, update readme ([d93cbf9](https://github.com/thi-ng/umbrella/commit/d93cbf9708c414e703fde61e80b5762f34899aa4))
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
# [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@2.1.7...@thi.ng/strings@3.0.0) (2021-10-12)
|
|
22
7
|
|
|
23
8
|
|
|
9
|
+
### Build System
|
|
24
10
|
|
|
25
|
-
|
|
11
|
+
* major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
|
|
26
12
|
|
|
27
13
|
|
|
28
14
|
### Features
|
|
29
15
|
|
|
30
|
-
* **strings:** add
|
|
31
|
-
* **strings:** major update wordWrap() & co. ([9c9c9cc](https://github.com/thi-ng/umbrella/commit/9c9c9cc1abe68ec32edbe91ac5c277561cafd3c4))
|
|
32
|
-
* **strings:** update split() args ([ea503e8](https://github.com/thi-ng/umbrella/commit/ea503e8abdf3598ccd0c1abf5d484164ea73890c))
|
|
16
|
+
* **strings:** add initials() ([5b8476f](https://github.com/thi-ng/umbrella/commit/5b8476f28dcfbbc252b11eb68a08f6d47aeca300))
|
|
33
17
|
|
|
34
18
|
|
|
35
19
|
### BREAKING CHANGES
|
|
36
20
|
|
|
37
|
-
*
|
|
21
|
+
* discontinue CommonJS & UMD versions
|
|
38
22
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
23
|
+
- only ESM modules will be published from now on
|
|
24
|
+
- CJS obsolete due to ESM support in recent versions of node:
|
|
25
|
+
- i.e. launch NodeJS via:
|
|
26
|
+
- `node --experimental-specifier-resolution=node --experimental-repl-await`
|
|
27
|
+
- in the node REPL use `await import(...)` instead of `require()`
|
|
28
|
+
- UMD obsolete due to widespread browser support for ESM
|
|
43
29
|
|
|
30
|
+
Also:
|
|
31
|
+
- normalize/restructure/reorg all package.json files
|
|
32
|
+
- cleanup all build scripts, remove obsolete
|
|
33
|
+
- switch from mocha to @thi.ng/testament for all tests
|
|
44
34
|
|
|
45
35
|
|
|
46
36
|
|
|
47
37
|
|
|
48
|
-
# [1.15.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.14.0...@thi.ng/strings@1.15.0) (2021-02-20)
|
|
49
38
|
|
|
50
39
|
|
|
51
|
-
|
|
40
|
+
# [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@2.0.0...@thi.ng/strings@2.1.0) (2021-03-24)
|
|
52
41
|
|
|
53
|
-
|
|
42
|
+
### Features
|
|
54
43
|
|
|
44
|
+
- **strings:** add ruler(), grid() fns, update readme ([d93cbf9](https://github.com/thi-ng/umbrella/commit/d93cbf9708c414e703fde61e80b5762f34899aa4))
|
|
55
45
|
|
|
46
|
+
# [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.15.6...@thi.ng/strings@2.0.0) (2021-03-24)
|
|
56
47
|
|
|
48
|
+
### Features
|
|
57
49
|
|
|
50
|
+
- **strings:** add ANSI predicates ([928694b](https://github.com/thi-ng/umbrella/commit/928694b0a46a7a58b0b4ab56562afceb0b6c8d8d))
|
|
51
|
+
- **strings:** major update wordWrap() & co. ([9c9c9cc](https://github.com/thi-ng/umbrella/commit/9c9c9cc1abe68ec32edbe91ac5c277561cafd3c4))
|
|
52
|
+
- **strings:** update split() args ([ea503e8](https://github.com/thi-ng/umbrella/commit/ea503e8abdf3598ccd0c1abf5d484164ea73890c))
|
|
58
53
|
|
|
59
|
-
|
|
54
|
+
### BREAKING CHANGES
|
|
60
55
|
|
|
56
|
+
- **strings:** major update wordWrap(), wordWrapLines() etc.
|
|
57
|
+
- update arguments
|
|
58
|
+
- add `WordWrapOpts` to configure wordwrap behavior
|
|
59
|
+
- add `IWordSplit` interface and `SPLIT_PLAIN`, `SPLIT_ANSI` impls
|
|
60
|
+
- implement hardwrap mode
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
# [1.15.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.14.0...@thi.ng/strings@1.15.0) (2021-02-20)
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
### Features
|
|
65
65
|
|
|
66
|
+
- **strings:** add int/intLocale, vector formatters ([ac55fe0](https://github.com/thi-ng/umbrella/commit/ac55fe007bed81d04848eddb1c4145eb26cdd437))
|
|
66
67
|
|
|
68
|
+
# [1.14.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.13.0...@thi.ng/strings@1.14.0) (2021-01-13)
|
|
67
69
|
|
|
70
|
+
### Features
|
|
68
71
|
|
|
72
|
+
- **strings:** add stringify() HOF ([4ab7e72](https://github.com/thi-ng/umbrella/commit/4ab7e72bf87cbf058a38ca85b5e2853a5f432d9d))
|
|
69
73
|
|
|
70
|
-
#
|
|
74
|
+
# [1.13.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.12.0...@thi.ng/strings@1.13.0) (2021-01-10)
|
|
71
75
|
|
|
76
|
+
### Features
|
|
72
77
|
|
|
73
|
-
|
|
78
|
+
- **strings:** add stripAnsi(), lengthAnsi() fns ([86fa81a](https://github.com/thi-ng/umbrella/commit/86fa81acb7dfcf1dc3d6f5600cbf427ee44cf722))
|
|
79
|
+
- **strings:** add tab conversion fns ([aefdd97](https://github.com/thi-ng/umbrella/commit/aefdd97e27fce2405860e817b9c5b4aedb6e59e4))
|
|
80
|
+
- **strings:** add wordWrap*() fns ([2a283c0](https://github.com/thi-ng/umbrella/commit/2a283c018592d8cc76f4ef83b69c6ce3c378aca6))
|
|
81
|
+
- **strings:** update padLeft/Right() args ([118f97f](https://github.com/thi-ng/umbrella/commit/118f97f1fca27671c53d184484a7b435e6eedf88))
|
|
74
82
|
|
|
75
|
-
|
|
76
|
-
* **strings:** add tab conversion fns ([aefdd97](https://github.com/thi-ng/umbrella/commit/aefdd97e27fce2405860e817b9c5b4aedb6e59e4))
|
|
77
|
-
* **strings:** add wordWrap*() fns ([2a283c0](https://github.com/thi-ng/umbrella/commit/2a283c018592d8cc76f4ef83b69c6ce3c378aca6))
|
|
78
|
-
* **strings:** update padLeft/Right() args ([118f97f](https://github.com/thi-ng/umbrella/commit/118f97f1fca27671c53d184484a7b435e6eedf88))
|
|
83
|
+
### Performance Improvements
|
|
79
84
|
|
|
85
|
+
- **strings:** simplify string default delim regexp ([bb62760](https://github.com/thi-ng/umbrella/commit/bb62760f2069a1f7edeaa09ce0e0639047789af3))
|
|
80
86
|
|
|
81
|
-
|
|
87
|
+
# [1.12.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.11.4...@thi.ng/strings@1.12.0) (2021-01-05)
|
|
82
88
|
|
|
83
|
-
|
|
89
|
+
### Features
|
|
84
90
|
|
|
91
|
+
- **strings:** add interpolateKeys() ([bd78d1d](https://github.com/thi-ng/umbrella/commit/bd78d1dba5e467e6cda452e6db6fcd0fb9a3cf19))
|
|
85
92
|
|
|
93
|
+
## [1.11.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.11.3...@thi.ng/strings@1.11.4) (2021-01-02)
|
|
86
94
|
|
|
95
|
+
### Bug Fixes
|
|
87
96
|
|
|
97
|
+
- **strings:** update slugifyGH() replacements ([#174](https://github.com/thi-ng/umbrella/issues/174)) ([98a9135](https://github.com/thi-ng/umbrella/commit/98a91351728d730446f9654fc93317c1bece77ed))
|
|
88
98
|
|
|
89
|
-
#
|
|
99
|
+
# [1.11.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.10.0...@thi.ng/strings@1.11.0) (2020-11-24)
|
|
90
100
|
|
|
101
|
+
### Features
|
|
91
102
|
|
|
92
|
-
|
|
103
|
+
- **strings:** add split() iterator ([6d2ec4f](https://github.com/thi-ng/umbrella/commit/6d2ec4fccc688acf5a541ea51c9705faca1c9835))
|
|
93
104
|
|
|
94
|
-
|
|
105
|
+
# [1.10.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.9.6...@thi.ng/strings@1.10.0) (2020-09-22)
|
|
95
106
|
|
|
107
|
+
### Features
|
|
96
108
|
|
|
109
|
+
- **strings:** add BOM const, update pkg meta ([b6751fc](https://github.com/thi-ng/umbrella/commit/b6751fc506a28a075ea9fee1a5f6d3520449f5af))
|
|
110
|
+
- **strings:** add escape(), update unescape(), add tests ([e0d5f1e](https://github.com/thi-ng/umbrella/commit/e0d5f1edcdf78b075908c4973586a0f1732fe006))
|
|
111
|
+
- **strings:** add unescape() ([924466b](https://github.com/thi-ng/umbrella/commit/924466bc5d5f16ced3da95fa2f24dab2bfad0679))
|
|
97
112
|
|
|
113
|
+
# [1.9.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.8.13...@thi.ng/strings@1.9.0) (2020-07-08)
|
|
98
114
|
|
|
115
|
+
### Features
|
|
99
116
|
|
|
100
|
-
|
|
117
|
+
- **strings:** add computeCursorPos() ([c178d00](https://github.com/thi-ng/umbrella/commit/c178d00edcdbe12cec492a1629c80bf359116b66))
|
|
101
118
|
|
|
119
|
+
# [1.8.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.7.0...@thi.ng/strings@1.8.0) (2020-03-28)
|
|
102
120
|
|
|
103
|
-
###
|
|
121
|
+
### Features
|
|
104
122
|
|
|
105
|
-
|
|
123
|
+
- **strings:** add join() HOF ([1c5c46f](https://github.com/thi-ng/umbrella/commit/1c5c46f5ac832865266613a6d71024507238b694))
|
|
124
|
+
- **strings:** add slugifyGH(), refactor slugify() ([1ef805b](https://github.com/thi-ng/umbrella/commit/1ef805be3f0347751eba6da0122e1277a5b81e21))
|
|
125
|
+
- **strings:** add trim() HOF ([350a6c6](https://github.com/thi-ng/umbrella/commit/350a6c6cb010e00f2053fb41eeb0f458ee8fb715))
|
|
106
126
|
|
|
127
|
+
# [1.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.6.0...@thi.ng/strings@1.7.0) (2020-03-06)
|
|
107
128
|
|
|
129
|
+
### Features
|
|
108
130
|
|
|
131
|
+
- **strings:** add char group LUTs for classification ([c3ff006](https://github.com/thi-ng/umbrella/commit/c3ff006b237bece057f675d62a47d29bab9df413))
|
|
109
132
|
|
|
133
|
+
# [1.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.5.2...@thi.ng/strings@1.6.0) (2020-03-01)
|
|
110
134
|
|
|
111
|
-
|
|
135
|
+
### Features
|
|
112
136
|
|
|
137
|
+
- **strings:** add defFormat() HOF ([62f4e04](https://github.com/thi-ng/umbrella/commit/62f4e04c72e8822930da3f337898dae0ea51f6d0))
|
|
113
138
|
|
|
114
|
-
|
|
139
|
+
# [1.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.4.0...@thi.ng/strings@1.5.0) (2020-02-25)
|
|
115
140
|
|
|
116
|
-
|
|
141
|
+
### Features
|
|
117
142
|
|
|
143
|
+
- **strings:** add uuid() formatter ([4592742](https://github.com/thi-ng/umbrella/commit/4592742daad1020aa336e3d819324f4555223160))
|
|
118
144
|
|
|
145
|
+
# [1.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.3.3...@thi.ng/strings@1.4.0) (2020-01-26)
|
|
119
146
|
|
|
147
|
+
### Features
|
|
120
148
|
|
|
149
|
+
- **strings:** add format() helpers (str, ignore) ([df87b7c](https://github.com/thi-ng/umbrella/commit/df87b7c7f0a1f9fa5b299fe8311fda02f40ab4cd))
|
|
150
|
+
- **strings:** add interpolate() ([a19e409](https://github.com/thi-ng/umbrella/commit/a19e4094494a8b4af6c35626e4a99394e0481a4e))
|
|
121
151
|
|
|
122
|
-
#
|
|
152
|
+
# [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.2.3...@thi.ng/strings@1.3.0) (2019-09-21)
|
|
123
153
|
|
|
154
|
+
### Features
|
|
124
155
|
|
|
125
|
-
|
|
156
|
+
- **strings:** add charRange(), add radix & zero-pad presets ([c9e5a63](https://github.com/thi-ng/umbrella/commit/c9e5a63))
|
|
126
157
|
|
|
127
|
-
|
|
128
|
-
* **strings:** add escape(), update unescape(), add tests ([e0d5f1e](https://github.com/thi-ng/umbrella/commit/e0d5f1edcdf78b075908c4973586a0f1732fe006))
|
|
129
|
-
* **strings:** add unescape() ([924466b](https://github.com/thi-ng/umbrella/commit/924466bc5d5f16ced3da95fa2f24dab2bfad0679))
|
|
158
|
+
# [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.1.3...@thi.ng/strings@1.2.0) (2019-07-07)
|
|
130
159
|
|
|
160
|
+
### Features
|
|
131
161
|
|
|
162
|
+
- **strings:** enable TS strict compiler flags (refactor) ([76cecb8](https://github.com/thi-ng/umbrella/commit/76cecb8))
|
|
132
163
|
|
|
164
|
+
# [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.0.7...@thi.ng/strings@1.1.0) (2019-04-15)
|
|
133
165
|
|
|
166
|
+
### Features
|
|
134
167
|
|
|
135
|
-
|
|
168
|
+
- **strings:** add hstr() (hollerith) ([619e9ef](https://github.com/thi-ng/umbrella/commit/619e9ef))
|
|
136
169
|
|
|
170
|
+
## [1.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.0.1...@thi.ng/strings@1.0.2) (2019-01-31)
|
|
137
171
|
|
|
138
|
-
###
|
|
172
|
+
### Bug Fixes
|
|
139
173
|
|
|
140
|
-
|
|
174
|
+
- **strings:** 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))
|
|
141
175
|
|
|
176
|
+
# [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.7.1...@thi.ng/strings@1.0.0) (2019-01-21)
|
|
142
177
|
|
|
178
|
+
### Build System
|
|
143
179
|
|
|
180
|
+
- update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
|
|
144
181
|
|
|
182
|
+
### Features
|
|
145
183
|
|
|
146
|
-
|
|
184
|
+
- **strings:** add floatFixedWidth(), update float() ([816c9c0](https://github.com/thi-ng/umbrella/commit/816c9c0))
|
|
147
185
|
|
|
186
|
+
### BREAKING CHANGES
|
|
148
187
|
|
|
149
|
-
|
|
188
|
+
- enabled multi-outputs (ES6 modules, CJS, UMD)
|
|
189
|
+
- build scripts now first build ES6 modules in package root, then call `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
|
|
190
|
+
- all imports MUST be updated to only refer to package level (not individual files anymore). tree shaking in user land will get rid of all unused imported symbols.
|
|
150
191
|
|
|
151
|
-
|
|
152
|
-
* **strings:** add slugifyGH(), refactor slugify() ([1ef805b](https://github.com/thi-ng/umbrella/commit/1ef805be3f0347751eba6da0122e1277a5b81e21))
|
|
153
|
-
* **strings:** add trim() HOF ([350a6c6](https://github.com/thi-ng/umbrella/commit/350a6c6cb010e00f2053fb41eeb0f458ee8fb715))
|
|
192
|
+
# [0.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.6.0...@thi.ng/strings@0.7.0) (2018-12-13)
|
|
154
193
|
|
|
194
|
+
### Bug Fixes
|
|
155
195
|
|
|
196
|
+
- **strings:** update kebab() ([1b298f7](https://github.com/thi-ng/umbrella/commit/1b298f7))
|
|
156
197
|
|
|
198
|
+
### Features
|
|
157
199
|
|
|
200
|
+
- **strings:** add slugify() ([8dcc73a](https://github.com/thi-ng/umbrella/commit/8dcc73a))
|
|
158
201
|
|
|
159
|
-
#
|
|
202
|
+
# [0.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.5.2...@thi.ng/strings@0.6.0) (2018-11-08)
|
|
160
203
|
|
|
204
|
+
### Features
|
|
161
205
|
|
|
162
|
-
|
|
206
|
+
- **strings:** add configurable units() HOF & presets ([33e915b](https://github.com/thi-ng/umbrella/commit/33e915b))
|
|
163
207
|
|
|
164
|
-
|
|
208
|
+
# [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.4.3...@thi.ng/strings@0.5.0) (2018-09-25)
|
|
165
209
|
|
|
210
|
+
### Features
|
|
166
211
|
|
|
212
|
+
- **strings:** add splice(), refactor repeat(), add tests ([0cce048](https://github.com/thi-ng/umbrella/commit/0cce048))
|
|
167
213
|
|
|
214
|
+
## [0.4.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.4.2...@thi.ng/strings@0.4.3) (2018-09-24)
|
|
168
215
|
|
|
216
|
+
### Bug Fixes
|
|
169
217
|
|
|
170
|
-
|
|
218
|
+
- **strings:** rename number parsers ([8cbfb97](https://github.com/thi-ng/umbrella/commit/8cbfb97))
|
|
171
219
|
|
|
220
|
+
# [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.2.0...@thi.ng/strings@0.3.0) (2018-08-24)
|
|
172
221
|
|
|
173
|
-
###
|
|
222
|
+
### Bug Fixes
|
|
174
223
|
|
|
175
|
-
|
|
224
|
+
- **strings:** buffer length (for null inputs) (`center()`) ([5209c42](https://github.com/thi-ng/umbrella/commit/5209c42))
|
|
176
225
|
|
|
226
|
+
### Features
|
|
177
227
|
|
|
228
|
+
- **strings:** add case converters ([653a175](https://github.com/thi-ng/umbrella/commit/653a175))
|
|
229
|
+
- **strings:** add truncateLeft() & wrap() stringers ([1a20bc2](https://github.com/thi-ng/umbrella/commit/1a20bc2))
|
|
178
230
|
|
|
231
|
+
# [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.1.1...@thi.ng/strings@0.2.0) (2018-08-08)
|
|
179
232
|
|
|
233
|
+
### Features
|
|
180
234
|
|
|
181
|
-
|
|
235
|
+
- **strings:** add opt prefix arg for radix() ([5864f2c](https://github.com/thi-ng/umbrella/commit/5864f2c))
|
|
182
236
|
|
|
237
|
+
## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.1.0...@thi.ng/strings@0.1.1) (2018-08-08)
|
|
183
238
|
|
|
184
|
-
###
|
|
185
|
-
|
|
186
|
-
* **strings:** add uuid() formatter ([4592742](https://github.com/thi-ng/umbrella/commit/4592742daad1020aa336e3d819324f4555223160))
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
# [1.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.3.3...@thi.ng/strings@1.4.0) (2020-01-26)
|
|
193
|
-
|
|
194
|
-
### Features
|
|
195
|
-
|
|
196
|
-
* **strings:** add format() helpers (str, ignore) ([df87b7c](https://github.com/thi-ng/umbrella/commit/df87b7c7f0a1f9fa5b299fe8311fda02f40ab4cd))
|
|
197
|
-
* **strings:** add interpolate() ([a19e409](https://github.com/thi-ng/umbrella/commit/a19e4094494a8b4af6c35626e4a99394e0481a4e))
|
|
198
|
-
|
|
199
|
-
# [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.2.3...@thi.ng/strings@1.3.0) (2019-09-21)
|
|
200
|
-
|
|
201
|
-
### Features
|
|
202
|
-
|
|
203
|
-
* **strings:** add charRange(), add radix & zero-pad presets ([c9e5a63](https://github.com/thi-ng/umbrella/commit/c9e5a63))
|
|
204
|
-
|
|
205
|
-
# [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.1.3...@thi.ng/strings@1.2.0) (2019-07-07)
|
|
206
|
-
|
|
207
|
-
### Features
|
|
208
|
-
|
|
209
|
-
* **strings:** enable TS strict compiler flags (refactor) ([76cecb8](https://github.com/thi-ng/umbrella/commit/76cecb8))
|
|
210
|
-
|
|
211
|
-
# [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.0.7...@thi.ng/strings@1.1.0) (2019-04-15)
|
|
212
|
-
|
|
213
|
-
### Features
|
|
214
|
-
|
|
215
|
-
* **strings:** add hstr() (hollerith) ([619e9ef](https://github.com/thi-ng/umbrella/commit/619e9ef))
|
|
239
|
+
### Bug Fixes
|
|
216
240
|
|
|
217
|
-
|
|
241
|
+
- **strings:** float type decl ([b2ebbfc](https://github.com/thi-ng/umbrella/commit/b2ebbfc))
|
|
218
242
|
|
|
219
|
-
|
|
243
|
+
# 0.1.0 (2018-08-08)
|
|
220
244
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
# [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.7.1...@thi.ng/strings@1.0.0) (2019-01-21)
|
|
224
|
-
|
|
225
|
-
### Build System
|
|
226
|
-
|
|
227
|
-
* update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
|
|
228
|
-
|
|
229
|
-
### Features
|
|
230
|
-
|
|
231
|
-
* **strings:** add floatFixedWidth(), update float() ([816c9c0](https://github.com/thi-ng/umbrella/commit/816c9c0))
|
|
232
|
-
|
|
233
|
-
### BREAKING CHANGES
|
|
234
|
-
|
|
235
|
-
* enabled multi-outputs (ES6 modules, CJS, UMD)
|
|
236
|
-
|
|
237
|
-
- build scripts now first build ES6 modules in package root, then call
|
|
238
|
-
`scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
|
|
239
|
-
- all imports MUST be updated to only refer to package level
|
|
240
|
-
(not individual files anymore). tree shaking in user land will get rid of
|
|
241
|
-
all unused imported symbols.
|
|
242
|
-
|
|
243
|
-
# [0.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.6.0...@thi.ng/strings@0.7.0) (2018-12-13)
|
|
244
|
-
|
|
245
|
-
### Bug Fixes
|
|
246
|
-
|
|
247
|
-
* **strings:** update kebab() ([1b298f7](https://github.com/thi-ng/umbrella/commit/1b298f7))
|
|
248
|
-
|
|
249
|
-
### Features
|
|
250
|
-
|
|
251
|
-
* **strings:** add slugify() ([8dcc73a](https://github.com/thi-ng/umbrella/commit/8dcc73a))
|
|
252
|
-
|
|
253
|
-
# [0.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.5.2...@thi.ng/strings@0.6.0) (2018-11-08)
|
|
254
|
-
|
|
255
|
-
### Features
|
|
256
|
-
|
|
257
|
-
* **strings:** add configurable units() HOF & presets ([33e915b](https://github.com/thi-ng/umbrella/commit/33e915b))
|
|
258
|
-
|
|
259
|
-
<a name="0.5.0"></a>
|
|
260
|
-
# [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.4.3...@thi.ng/strings@0.5.0) (2018-09-25)
|
|
261
|
-
|
|
262
|
-
### Features
|
|
263
|
-
|
|
264
|
-
* **strings:** add splice(), refactor repeat(), add tests ([0cce048](https://github.com/thi-ng/umbrella/commit/0cce048))
|
|
265
|
-
|
|
266
|
-
<a name="0.4.3"></a>
|
|
267
|
-
## [0.4.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.4.2...@thi.ng/strings@0.4.3) (2018-09-24)
|
|
268
|
-
|
|
269
|
-
### Bug Fixes
|
|
270
|
-
|
|
271
|
-
* **strings:** rename number parsers ([8cbfb97](https://github.com/thi-ng/umbrella/commit/8cbfb97))
|
|
272
|
-
|
|
273
|
-
<a name="0.3.0"></a>
|
|
274
|
-
# [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.2.0...@thi.ng/strings@0.3.0) (2018-08-24)
|
|
275
|
-
|
|
276
|
-
### Bug Fixes
|
|
277
|
-
|
|
278
|
-
* **strings:** buffer length (for null inputs) (`center()`) ([5209c42](https://github.com/thi-ng/umbrella/commit/5209c42))
|
|
279
|
-
|
|
280
|
-
### Features
|
|
281
|
-
|
|
282
|
-
* **strings:** add case converters ([653a175](https://github.com/thi-ng/umbrella/commit/653a175))
|
|
283
|
-
* **strings:** add truncateLeft() & wrap() stringers ([1a20bc2](https://github.com/thi-ng/umbrella/commit/1a20bc2))
|
|
284
|
-
|
|
285
|
-
<a name="0.2.0"></a>
|
|
286
|
-
# [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.1.1...@thi.ng/strings@0.2.0) (2018-08-08)
|
|
287
|
-
|
|
288
|
-
### Features
|
|
289
|
-
|
|
290
|
-
* **strings:** add opt prefix arg for radix() ([5864f2c](https://github.com/thi-ng/umbrella/commit/5864f2c))
|
|
291
|
-
|
|
292
|
-
<a name="0.1.1"></a>
|
|
293
|
-
## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@0.1.0...@thi.ng/strings@0.1.1) (2018-08-08)
|
|
294
|
-
|
|
295
|
-
### Bug Fixes
|
|
296
|
-
|
|
297
|
-
* **strings:** float type decl ([b2ebbfc](https://github.com/thi-ng/umbrella/commit/b2ebbfc))
|
|
298
|
-
|
|
299
|
-
<a name="0.1.0"></a>
|
|
300
|
-
# 0.1.0 (2018-08-08)
|
|
301
|
-
|
|
302
|
-
### Features
|
|
245
|
+
### Features
|
|
303
246
|
|
|
304
|
-
|
|
247
|
+
- **strings:** re-import & update [@thi](https://github.com/thi).ng/strings from MBP2010 ([40781eb](https://github.com/thi-ng/umbrella/commit/40781eb))
|
package/README.md
CHANGED
|
@@ -125,15 +125,23 @@ Partially based on Clojure version of [thi.ng/strf](http://thi.ng/strf).
|
|
|
125
125
|
yarn add @thi.ng/strings
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
+
ES module import:
|
|
129
|
+
|
|
128
130
|
```html
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
<script type="module" src="https://cdn.skypack.dev/@thi.ng/strings"></script>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
[Skypack documentation](https://docs.skypack.dev/)
|
|
135
|
+
|
|
136
|
+
For NodeJS (v14.6+):
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
node --experimental-specifier-resolution=node --experimental-repl-await
|
|
131
140
|
|
|
132
|
-
|
|
133
|
-
<script src="https://unpkg.com/@thi.ng/strings/lib/index.umd.js" crossorigin></script>
|
|
141
|
+
> const strings = await import("@thi.ng/strings");
|
|
134
142
|
```
|
|
135
143
|
|
|
136
|
-
Package sizes (gzipped, pre-treeshake): ESM: 4.
|
|
144
|
+
Package sizes (gzipped, pre-treeshake): ESM: 4.12 KB
|
|
137
145
|
|
|
138
146
|
## Dependencies
|
|
139
147
|
|
package/center.js
CHANGED
package/float.js
CHANGED
package/groups.js
CHANGED
|
@@ -43,11 +43,15 @@ export const UPPER = defGroup(charRange("A", "Z"));
|
|
|
43
43
|
/**
|
|
44
44
|
* Combination of {@link UPPER} and {@link LOWER}.
|
|
45
45
|
*/
|
|
46
|
-
export const ALPHA = Object.freeze(
|
|
46
|
+
export const ALPHA = Object.freeze({ ...UPPER, ...LOWER });
|
|
47
47
|
/**
|
|
48
48
|
* Combination of {@link ALPHA} and {@link DIGITS} and '_'.
|
|
49
49
|
*/
|
|
50
|
-
export const ALPHA_NUM = Object.freeze(
|
|
50
|
+
export const ALPHA_NUM = Object.freeze({
|
|
51
|
+
...ALPHA,
|
|
52
|
+
...DIGITS,
|
|
53
|
+
_: true,
|
|
54
|
+
});
|
|
51
55
|
/**
|
|
52
56
|
* Object with ASCII punctuation characters as keys and their values set
|
|
53
57
|
* to true. All others undefined.
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/initials.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Takes an array of string parts and returns a new string of each part's
|
|
3
|
+
* initial character. The `mode` arg can be used to customize result casing
|
|
4
|
+
* (default: uppercase). If `mode` is null, the original casing will be kept.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* initials(["alicia", "bella", "carerra"]);
|
|
9
|
+
* // "ABC"
|
|
10
|
+
*
|
|
11
|
+
* initials("shader-ast-GLSL".split("-"))
|
|
12
|
+
* // "SAG"
|
|
13
|
+
*
|
|
14
|
+
* initials("Ludwig van Beethoven".split(" "), null)
|
|
15
|
+
* // "LvB"
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param parts
|
|
19
|
+
* @param mode
|
|
20
|
+
*/
|
|
21
|
+
export declare const initials: (parts: string[], mode?: "u" | "l" | null) => string;
|
|
22
|
+
//# sourceMappingURL=initials.d.ts.map
|
package/initials.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Takes an array of string parts and returns a new string of each part's
|
|
3
|
+
* initial character. The `mode` arg can be used to customize result casing
|
|
4
|
+
* (default: uppercase). If `mode` is null, the original casing will be kept.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* initials(["alicia", "bella", "carerra"]);
|
|
9
|
+
* // "ABC"
|
|
10
|
+
*
|
|
11
|
+
* initials("shader-ast-GLSL".split("-"))
|
|
12
|
+
* // "SAG"
|
|
13
|
+
*
|
|
14
|
+
* initials("Ludwig van Beethoven".split(" "), null)
|
|
15
|
+
* // "LvB"
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param parts
|
|
19
|
+
* @param mode
|
|
20
|
+
*/
|
|
21
|
+
export const initials = (parts, mode = "u") => {
|
|
22
|
+
const res = parts.map((x) => x[0]).join("");
|
|
23
|
+
return mode === "u"
|
|
24
|
+
? res.toUpperCase()
|
|
25
|
+
: mode === "l"
|
|
26
|
+
? res.toLowerCase()
|
|
27
|
+
: res;
|
|
28
|
+
};
|
package/int.js
CHANGED
package/interpolate.js
CHANGED
package/join.js
CHANGED