@thi.ng/strings 2.1.4 → 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 -209
- package/README.md +14 -6
- 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,326 +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.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@2.1.2...@thi.ng/strings@2.1.3) (2021-08-04)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @thi.ng/strings
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## [2.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@2.1.1...@thi.ng/strings@2.1.2) (2021-07-01)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @thi.ng/strings
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## [2.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@2.1.0...@thi.ng/strings@2.1.1) (2021-06-08)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @thi.ng/strings
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# [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)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Features
|
|
42
|
-
|
|
43
|
-
* **strings:** add ruler(), grid() fns, update readme ([d93cbf9](https://github.com/thi-ng/umbrella/commit/d93cbf9708c414e703fde61e80b5762f34899aa4))
|
|
44
|
-
|
|
45
|
-
|
|
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)
|
|
46
7
|
|
|
47
8
|
|
|
9
|
+
### Build System
|
|
48
10
|
|
|
49
|
-
|
|
11
|
+
* major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
|
|
50
12
|
|
|
51
13
|
|
|
52
14
|
### Features
|
|
53
15
|
|
|
54
|
-
* **strings:** add
|
|
55
|
-
* **strings:** major update wordWrap() & co. ([9c9c9cc](https://github.com/thi-ng/umbrella/commit/9c9c9cc1abe68ec32edbe91ac5c277561cafd3c4))
|
|
56
|
-
* **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))
|
|
57
17
|
|
|
58
18
|
|
|
59
19
|
### BREAKING CHANGES
|
|
60
20
|
|
|
61
|
-
*
|
|
21
|
+
* discontinue CommonJS & UMD versions
|
|
62
22
|
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
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
|
|
67
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
|
|
68
34
|
|
|
69
35
|
|
|
70
36
|
|
|
71
37
|
|
|
72
|
-
# [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)
|
|
73
38
|
|
|
74
39
|
|
|
75
|
-
|
|
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)
|
|
76
41
|
|
|
77
|
-
|
|
42
|
+
### Features
|
|
78
43
|
|
|
44
|
+
- **strings:** add ruler(), grid() fns, update readme ([d93cbf9](https://github.com/thi-ng/umbrella/commit/d93cbf9708c414e703fde61e80b5762f34899aa4))
|
|
79
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)
|
|
80
47
|
|
|
48
|
+
### Features
|
|
81
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))
|
|
82
53
|
|
|
83
|
-
|
|
54
|
+
### BREAKING CHANGES
|
|
84
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
|
|
85
61
|
|
|
86
|
-
|
|
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)
|
|
87
63
|
|
|
88
|
-
|
|
64
|
+
### Features
|
|
89
65
|
|
|
66
|
+
- **strings:** add int/intLocale, vector formatters ([ac55fe0](https://github.com/thi-ng/umbrella/commit/ac55fe007bed81d04848eddb1c4145eb26cdd437))
|
|
90
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)
|
|
91
69
|
|
|
70
|
+
### Features
|
|
92
71
|
|
|
72
|
+
- **strings:** add stringify() HOF ([4ab7e72](https://github.com/thi-ng/umbrella/commit/4ab7e72bf87cbf058a38ca85b5e2853a5f432d9d))
|
|
93
73
|
|
|
94
|
-
#
|
|
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)
|
|
95
75
|
|
|
76
|
+
### Features
|
|
96
77
|
|
|
97
|
-
|
|
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))
|
|
98
82
|
|
|
99
|
-
|
|
100
|
-
* **strings:** add tab conversion fns ([aefdd97](https://github.com/thi-ng/umbrella/commit/aefdd97e27fce2405860e817b9c5b4aedb6e59e4))
|
|
101
|
-
* **strings:** add wordWrap*() fns ([2a283c0](https://github.com/thi-ng/umbrella/commit/2a283c018592d8cc76f4ef83b69c6ce3c378aca6))
|
|
102
|
-
* **strings:** update padLeft/Right() args ([118f97f](https://github.com/thi-ng/umbrella/commit/118f97f1fca27671c53d184484a7b435e6eedf88))
|
|
83
|
+
### Performance Improvements
|
|
103
84
|
|
|
85
|
+
- **strings:** simplify string default delim regexp ([bb62760](https://github.com/thi-ng/umbrella/commit/bb62760f2069a1f7edeaa09ce0e0639047789af3))
|
|
104
86
|
|
|
105
|
-
|
|
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)
|
|
106
88
|
|
|
107
|
-
|
|
89
|
+
### Features
|
|
108
90
|
|
|
91
|
+
- **strings:** add interpolateKeys() ([bd78d1d](https://github.com/thi-ng/umbrella/commit/bd78d1dba5e467e6cda452e6db6fcd0fb9a3cf19))
|
|
109
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)
|
|
110
94
|
|
|
95
|
+
### Bug Fixes
|
|
111
96
|
|
|
97
|
+
- **strings:** update slugifyGH() replacements ([#174](https://github.com/thi-ng/umbrella/issues/174)) ([98a9135](https://github.com/thi-ng/umbrella/commit/98a91351728d730446f9654fc93317c1bece77ed))
|
|
112
98
|
|
|
113
|
-
#
|
|
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)
|
|
114
100
|
|
|
101
|
+
### Features
|
|
115
102
|
|
|
116
|
-
|
|
103
|
+
- **strings:** add split() iterator ([6d2ec4f](https://github.com/thi-ng/umbrella/commit/6d2ec4fccc688acf5a541ea51c9705faca1c9835))
|
|
117
104
|
|
|
118
|
-
|
|
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)
|
|
119
106
|
|
|
107
|
+
### Features
|
|
120
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))
|
|
121
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)
|
|
122
114
|
|
|
115
|
+
### Features
|
|
123
116
|
|
|
124
|
-
|
|
117
|
+
- **strings:** add computeCursorPos() ([c178d00](https://github.com/thi-ng/umbrella/commit/c178d00edcdbe12cec492a1629c80bf359116b66))
|
|
125
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)
|
|
126
120
|
|
|
127
|
-
###
|
|
121
|
+
### Features
|
|
128
122
|
|
|
129
|
-
|
|
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))
|
|
130
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)
|
|
131
128
|
|
|
129
|
+
### Features
|
|
132
130
|
|
|
131
|
+
- **strings:** add char group LUTs for classification ([c3ff006](https://github.com/thi-ng/umbrella/commit/c3ff006b237bece057f675d62a47d29bab9df413))
|
|
133
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)
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
### Features
|
|
136
136
|
|
|
137
|
+
- **strings:** add defFormat() HOF ([62f4e04](https://github.com/thi-ng/umbrella/commit/62f4e04c72e8822930da3f337898dae0ea51f6d0))
|
|
137
138
|
|
|
138
|
-
|
|
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)
|
|
139
140
|
|
|
140
|
-
|
|
141
|
+
### Features
|
|
141
142
|
|
|
143
|
+
- **strings:** add uuid() formatter ([4592742](https://github.com/thi-ng/umbrella/commit/4592742daad1020aa336e3d819324f4555223160))
|
|
142
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)
|
|
143
146
|
|
|
147
|
+
### Features
|
|
144
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))
|
|
145
151
|
|
|
146
|
-
#
|
|
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)
|
|
147
153
|
|
|
154
|
+
### Features
|
|
148
155
|
|
|
149
|
-
|
|
156
|
+
- **strings:** add charRange(), add radix & zero-pad presets ([c9e5a63](https://github.com/thi-ng/umbrella/commit/c9e5a63))
|
|
150
157
|
|
|
151
|
-
|
|
152
|
-
* **strings:** add escape(), update unescape(), add tests ([e0d5f1e](https://github.com/thi-ng/umbrella/commit/e0d5f1edcdf78b075908c4973586a0f1732fe006))
|
|
153
|
-
* **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)
|
|
154
159
|
|
|
160
|
+
### Features
|
|
155
161
|
|
|
162
|
+
- **strings:** enable TS strict compiler flags (refactor) ([76cecb8](https://github.com/thi-ng/umbrella/commit/76cecb8))
|
|
156
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)
|
|
157
165
|
|
|
166
|
+
### Features
|
|
158
167
|
|
|
159
|
-
|
|
168
|
+
- **strings:** add hstr() (hollerith) ([619e9ef](https://github.com/thi-ng/umbrella/commit/619e9ef))
|
|
160
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)
|
|
161
171
|
|
|
162
|
-
###
|
|
172
|
+
### Bug Fixes
|
|
163
173
|
|
|
164
|
-
|
|
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))
|
|
165
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)
|
|
166
177
|
|
|
178
|
+
### Build System
|
|
167
179
|
|
|
180
|
+
- update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
|
|
168
181
|
|
|
182
|
+
### Features
|
|
169
183
|
|
|
170
|
-
|
|
184
|
+
- **strings:** add floatFixedWidth(), update float() ([816c9c0](https://github.com/thi-ng/umbrella/commit/816c9c0))
|
|
171
185
|
|
|
186
|
+
### BREAKING CHANGES
|
|
172
187
|
|
|
173
|
-
|
|
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.
|
|
174
191
|
|
|
175
|
-
|
|
176
|
-
* **strings:** add slugifyGH(), refactor slugify() ([1ef805b](https://github.com/thi-ng/umbrella/commit/1ef805be3f0347751eba6da0122e1277a5b81e21))
|
|
177
|
-
* **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)
|
|
178
193
|
|
|
194
|
+
### Bug Fixes
|
|
179
195
|
|
|
196
|
+
- **strings:** update kebab() ([1b298f7](https://github.com/thi-ng/umbrella/commit/1b298f7))
|
|
180
197
|
|
|
198
|
+
### Features
|
|
181
199
|
|
|
200
|
+
- **strings:** add slugify() ([8dcc73a](https://github.com/thi-ng/umbrella/commit/8dcc73a))
|
|
182
201
|
|
|
183
|
-
#
|
|
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)
|
|
184
203
|
|
|
204
|
+
### Features
|
|
185
205
|
|
|
186
|
-
|
|
206
|
+
- **strings:** add configurable units() HOF & presets ([33e915b](https://github.com/thi-ng/umbrella/commit/33e915b))
|
|
187
207
|
|
|
188
|
-
|
|
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)
|
|
189
209
|
|
|
210
|
+
### Features
|
|
190
211
|
|
|
212
|
+
- **strings:** add splice(), refactor repeat(), add tests ([0cce048](https://github.com/thi-ng/umbrella/commit/0cce048))
|
|
191
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)
|
|
192
215
|
|
|
216
|
+
### Bug Fixes
|
|
193
217
|
|
|
194
|
-
|
|
218
|
+
- **strings:** rename number parsers ([8cbfb97](https://github.com/thi-ng/umbrella/commit/8cbfb97))
|
|
195
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)
|
|
196
221
|
|
|
197
|
-
###
|
|
222
|
+
### Bug Fixes
|
|
198
223
|
|
|
199
|
-
|
|
224
|
+
- **strings:** buffer length (for null inputs) (`center()`) ([5209c42](https://github.com/thi-ng/umbrella/commit/5209c42))
|
|
200
225
|
|
|
226
|
+
### Features
|
|
201
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))
|
|
202
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)
|
|
203
232
|
|
|
233
|
+
### Features
|
|
204
234
|
|
|
205
|
-
|
|
235
|
+
- **strings:** add opt prefix arg for radix() ([5864f2c](https://github.com/thi-ng/umbrella/commit/5864f2c))
|
|
206
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)
|
|
207
238
|
|
|
208
|
-
###
|
|
209
|
-
|
|
210
|
-
* **strings:** add uuid() formatter ([4592742](https://github.com/thi-ng/umbrella/commit/4592742daad1020aa336e3d819324f4555223160))
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
# [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)
|
|
217
|
-
|
|
218
|
-
### Features
|
|
219
|
-
|
|
220
|
-
* **strings:** add format() helpers (str, ignore) ([df87b7c](https://github.com/thi-ng/umbrella/commit/df87b7c7f0a1f9fa5b299fe8311fda02f40ab4cd))
|
|
221
|
-
* **strings:** add interpolate() ([a19e409](https://github.com/thi-ng/umbrella/commit/a19e4094494a8b4af6c35626e4a99394e0481a4e))
|
|
222
|
-
|
|
223
|
-
# [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)
|
|
224
|
-
|
|
225
|
-
### Features
|
|
239
|
+
### Bug Fixes
|
|
226
240
|
|
|
227
|
-
|
|
241
|
+
- **strings:** float type decl ([b2ebbfc](https://github.com/thi-ng/umbrella/commit/b2ebbfc))
|
|
228
242
|
|
|
229
|
-
#
|
|
243
|
+
# 0.1.0 (2018-08-08)
|
|
230
244
|
|
|
231
|
-
###
|
|
232
|
-
|
|
233
|
-
* **strings:** enable TS strict compiler flags (refactor) ([76cecb8](https://github.com/thi-ng/umbrella/commit/76cecb8))
|
|
234
|
-
|
|
235
|
-
# [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)
|
|
236
|
-
|
|
237
|
-
### Features
|
|
238
|
-
|
|
239
|
-
* **strings:** add hstr() (hollerith) ([619e9ef](https://github.com/thi-ng/umbrella/commit/619e9ef))
|
|
240
|
-
|
|
241
|
-
## [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)
|
|
242
|
-
|
|
243
|
-
### Bug Fixes
|
|
244
|
-
|
|
245
|
-
* **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))
|
|
246
|
-
|
|
247
|
-
# [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)
|
|
248
|
-
|
|
249
|
-
### Build System
|
|
250
|
-
|
|
251
|
-
* update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
|
|
252
|
-
|
|
253
|
-
### Features
|
|
254
|
-
|
|
255
|
-
* **strings:** add floatFixedWidth(), update float() ([816c9c0](https://github.com/thi-ng/umbrella/commit/816c9c0))
|
|
256
|
-
|
|
257
|
-
### BREAKING CHANGES
|
|
258
|
-
|
|
259
|
-
* enabled multi-outputs (ES6 modules, CJS, UMD)
|
|
260
|
-
|
|
261
|
-
- build scripts now first build ES6 modules in package root, then call
|
|
262
|
-
`scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
|
|
263
|
-
- all imports MUST be updated to only refer to package level
|
|
264
|
-
(not individual files anymore). tree shaking in user land will get rid of
|
|
265
|
-
all unused imported symbols.
|
|
266
|
-
|
|
267
|
-
# [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)
|
|
268
|
-
|
|
269
|
-
### Bug Fixes
|
|
270
|
-
|
|
271
|
-
* **strings:** update kebab() ([1b298f7](https://github.com/thi-ng/umbrella/commit/1b298f7))
|
|
272
|
-
|
|
273
|
-
### Features
|
|
274
|
-
|
|
275
|
-
* **strings:** add slugify() ([8dcc73a](https://github.com/thi-ng/umbrella/commit/8dcc73a))
|
|
276
|
-
|
|
277
|
-
# [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)
|
|
278
|
-
|
|
279
|
-
### Features
|
|
280
|
-
|
|
281
|
-
* **strings:** add configurable units() HOF & presets ([33e915b](https://github.com/thi-ng/umbrella/commit/33e915b))
|
|
282
|
-
|
|
283
|
-
<a name="0.5.0"></a>
|
|
284
|
-
# [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)
|
|
285
|
-
|
|
286
|
-
### Features
|
|
287
|
-
|
|
288
|
-
* **strings:** add splice(), refactor repeat(), add tests ([0cce048](https://github.com/thi-ng/umbrella/commit/0cce048))
|
|
289
|
-
|
|
290
|
-
<a name="0.4.3"></a>
|
|
291
|
-
## [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)
|
|
292
|
-
|
|
293
|
-
### Bug Fixes
|
|
294
|
-
|
|
295
|
-
* **strings:** rename number parsers ([8cbfb97](https://github.com/thi-ng/umbrella/commit/8cbfb97))
|
|
296
|
-
|
|
297
|
-
<a name="0.3.0"></a>
|
|
298
|
-
# [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)
|
|
299
|
-
|
|
300
|
-
### Bug Fixes
|
|
301
|
-
|
|
302
|
-
* **strings:** buffer length (for null inputs) (`center()`) ([5209c42](https://github.com/thi-ng/umbrella/commit/5209c42))
|
|
303
|
-
|
|
304
|
-
### Features
|
|
305
|
-
|
|
306
|
-
* **strings:** add case converters ([653a175](https://github.com/thi-ng/umbrella/commit/653a175))
|
|
307
|
-
* **strings:** add truncateLeft() & wrap() stringers ([1a20bc2](https://github.com/thi-ng/umbrella/commit/1a20bc2))
|
|
308
|
-
|
|
309
|
-
<a name="0.2.0"></a>
|
|
310
|
-
# [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)
|
|
311
|
-
|
|
312
|
-
### Features
|
|
313
|
-
|
|
314
|
-
* **strings:** add opt prefix arg for radix() ([5864f2c](https://github.com/thi-ng/umbrella/commit/5864f2c))
|
|
315
|
-
|
|
316
|
-
<a name="0.1.1"></a>
|
|
317
|
-
## [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)
|
|
318
|
-
|
|
319
|
-
### Bug Fixes
|
|
320
|
-
|
|
321
|
-
* **strings:** float type decl ([b2ebbfc](https://github.com/thi-ng/umbrella/commit/b2ebbfc))
|
|
322
|
-
|
|
323
|
-
<a name="0.1.0"></a>
|
|
324
|
-
# 0.1.0 (2018-08-08)
|
|
325
|
-
|
|
326
|
-
### Features
|
|
245
|
+
### Features
|
|
327
246
|
|
|
328
|
-
|
|
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
|
|
|
@@ -151,7 +159,7 @@ directory are using this package.
|
|
|
151
159
|
A selection:
|
|
152
160
|
|
|
153
161
|
| Screenshot | Description | Live demo | Source |
|
|
154
|
-
|
|
162
|
+
|:---------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------|:----------------------------------------------------------|:---------------------------------------------------------------------------------------|
|
|
155
163
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/crypto-chart.png" width="240"/> | Basic crypto-currency candle chart with multiple moving averages plots | [Demo](https://demo.thi.ng/umbrella/crypto-chart/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/crypto-chart) |
|
|
156
164
|
| | Basic SPA example with atom-based UI router | [Demo](https://demo.thi.ng/umbrella/login-form/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/login-form) |
|
|
157
165
|
| <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/rstream-spreadsheet.png" width="240"/> | rstream based spreadsheet w/ S-expression formula DSL | [Demo](https://demo.thi.ng/umbrella/rstream-spreadsheet/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rstream-spreadsheet) |
|
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