@thi.ng/strings 2.1.7 → 3.1.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 +137 -159
- package/README.md +14 -5
- package/case.d.ts +1 -1
- package/center.d.ts +1 -1
- package/center.js +3 -3
- package/entities.d.ts +7 -0
- package/entities.js +24 -0
- package/escape.js +1 -1
- package/float.d.ts +1 -1
- package/float.js +2 -2
- package/groups.js +7 -3
- package/hollerith.d.ts +1 -1
- package/index.d.ts +36 -34
- package/index.js +36 -34
- package/initials.d.ts +22 -0
- package/initials.js +28 -0
- package/int.d.ts +1 -1
- package/int.js +1 -1
- package/interpolate.js +1 -1
- package/join.d.ts +1 -1
- package/join.js +1 -1
- package/package.json +138 -25
- package/pad-left.js +2 -2
- package/pad-right.js +2 -2
- package/percent.d.ts +1 -1
- package/radix.d.ts +1 -1
- package/radix.js +2 -2
- package/repeat.js +1 -1
- package/ruler.js +1 -1
- package/slugify.d.ts +1 -1
- package/splice.js +1 -1
- package/stringify.d.ts +1 -1
- package/tabs.js +1 -1
- package/trim.d.ts +1 -1
- package/trim.js +1 -1
- package/truncate-left.d.ts +1 -1
- package/truncate-left.js +4 -2
- package/truncate.d.ts +1 -1
- package/truncate.js +1 -1
- package/units.d.ts +1 -1
- package/units.js +1 -1
- package/vector.d.ts +1 -1
- package/vector.js +2 -2
- package/word-wrap.d.ts +1 -1
- package/word-wrap.js +9 -3
- package/wrap.d.ts +1 -1
- 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/index.d.ts
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./ansi";
|
|
3
|
-
export * from "./case";
|
|
4
|
-
export * from "./center";
|
|
5
|
-
export * from "./cursor";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./
|
|
19
|
-
export * from "./
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./
|
|
22
|
-
export * from "./
|
|
23
|
-
export * from "./
|
|
24
|
-
export * from "./
|
|
25
|
-
export * from "./
|
|
26
|
-
export * from "./
|
|
27
|
-
export * from "./
|
|
28
|
-
export * from "./
|
|
29
|
-
export * from "./
|
|
30
|
-
export * from "./
|
|
31
|
-
export * from "./
|
|
32
|
-
export * from "./
|
|
33
|
-
export * from "./
|
|
34
|
-
export * from "./
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./ansi.js";
|
|
3
|
+
export * from "./case.js";
|
|
4
|
+
export * from "./center.js";
|
|
5
|
+
export * from "./cursor.js";
|
|
6
|
+
export * from "./entities.js";
|
|
7
|
+
export * from "./escape.js";
|
|
8
|
+
export * from "./float.js";
|
|
9
|
+
export * from "./format.js";
|
|
10
|
+
export * from "./groups.js";
|
|
11
|
+
export * from "./hollerith.js";
|
|
12
|
+
export * from "./initials.js";
|
|
13
|
+
export * from "./int.js";
|
|
14
|
+
export * from "./interpolate.js";
|
|
15
|
+
export * from "./join.js";
|
|
16
|
+
export * from "./pad-left.js";
|
|
17
|
+
export * from "./pad-right.js";
|
|
18
|
+
export * from "./parse.js";
|
|
19
|
+
export * from "./percent.js";
|
|
20
|
+
export * from "./radix.js";
|
|
21
|
+
export * from "./range.js";
|
|
22
|
+
export * from "./repeat.js";
|
|
23
|
+
export * from "./ruler.js";
|
|
24
|
+
export * from "./slugify.js";
|
|
25
|
+
export * from "./splice.js";
|
|
26
|
+
export * from "./split.js";
|
|
27
|
+
export * from "./stringify.js";
|
|
28
|
+
export * from "./tabs.js";
|
|
29
|
+
export * from "./trim.js";
|
|
30
|
+
export * from "./truncate.js";
|
|
31
|
+
export * from "./truncate-left.js";
|
|
32
|
+
export * from "./units.js";
|
|
33
|
+
export * from "./uuid.js";
|
|
34
|
+
export * from "./vector.js";
|
|
35
|
+
export * from "./wrap.js";
|
|
36
|
+
export * from "./word-wrap.js";
|
|
35
37
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./ansi";
|
|
3
|
-
export * from "./case";
|
|
4
|
-
export * from "./center";
|
|
5
|
-
export * from "./cursor";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./
|
|
19
|
-
export * from "./
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./
|
|
22
|
-
export * from "./
|
|
23
|
-
export * from "./
|
|
24
|
-
export * from "./
|
|
25
|
-
export * from "./
|
|
26
|
-
export * from "./
|
|
27
|
-
export * from "./
|
|
28
|
-
export * from "./
|
|
29
|
-
export * from "./
|
|
30
|
-
export * from "./
|
|
31
|
-
export * from "./
|
|
32
|
-
export * from "./
|
|
33
|
-
export * from "./
|
|
34
|
-
export * from "./
|
|
1
|
+
export * from "./api.js";
|
|
2
|
+
export * from "./ansi.js";
|
|
3
|
+
export * from "./case.js";
|
|
4
|
+
export * from "./center.js";
|
|
5
|
+
export * from "./cursor.js";
|
|
6
|
+
export * from "./entities.js";
|
|
7
|
+
export * from "./escape.js";
|
|
8
|
+
export * from "./float.js";
|
|
9
|
+
export * from "./format.js";
|
|
10
|
+
export * from "./groups.js";
|
|
11
|
+
export * from "./hollerith.js";
|
|
12
|
+
export * from "./initials.js";
|
|
13
|
+
export * from "./int.js";
|
|
14
|
+
export * from "./interpolate.js";
|
|
15
|
+
export * from "./join.js";
|
|
16
|
+
export * from "./pad-left.js";
|
|
17
|
+
export * from "./pad-right.js";
|
|
18
|
+
export * from "./parse.js";
|
|
19
|
+
export * from "./percent.js";
|
|
20
|
+
export * from "./radix.js";
|
|
21
|
+
export * from "./range.js";
|
|
22
|
+
export * from "./repeat.js";
|
|
23
|
+
export * from "./ruler.js";
|
|
24
|
+
export * from "./slugify.js";
|
|
25
|
+
export * from "./splice.js";
|
|
26
|
+
export * from "./split.js";
|
|
27
|
+
export * from "./stringify.js";
|
|
28
|
+
export * from "./tabs.js";
|
|
29
|
+
export * from "./trim.js";
|
|
30
|
+
export * from "./truncate.js";
|
|
31
|
+
export * from "./truncate-left.js";
|
|
32
|
+
export * from "./units.js";
|
|
33
|
+
export * from "./uuid.js";
|
|
34
|
+
export * from "./vector.js";
|
|
35
|
+
export * from "./wrap.js";
|
|
36
|
+
export * from "./word-wrap.js";
|
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.d.ts
CHANGED
package/int.js
CHANGED
package/interpolate.js
CHANGED
package/join.d.ts
CHANGED
package/join.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/strings",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Various string formatting & utility functions",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"module": "./index.js",
|
|
6
|
-
"main": "./lib/index.js",
|
|
7
|
-
"umd:main": "./lib/index.umd.js",
|
|
8
7
|
"typings": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
@@ -24,30 +24,24 @@
|
|
|
24
24
|
"author": "Karsten Schmidt <k+npm@thi.ng>",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "yarn clean &&
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"build:test": "rimraf build && tsc -p test/tsconfig.json",
|
|
31
|
-
"build:check": "tsc --isolatedModules --noEmit",
|
|
32
|
-
"test": "mocha test",
|
|
33
|
-
"cover": "nyc mocha test && nyc report --reporter=lcov",
|
|
34
|
-
"clean": "rimraf *.js *.d.ts *.map .nyc_output build coverage doc lib",
|
|
35
|
-
"doc:readme": "ts-node -P ../../tools/tsconfig.json ../../tools/src/readme.ts",
|
|
36
|
-
"doc": "typedoc --excludePrivate --out doc --theme ../../tools/doc/typedoc-theme src/index.ts",
|
|
27
|
+
"build": "yarn clean && tsc --declaration",
|
|
28
|
+
"clean": "rimraf *.js *.d.ts *.map doc",
|
|
29
|
+
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
37
30
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
|
|
38
|
-
"
|
|
31
|
+
"doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
|
|
32
|
+
"doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
|
|
33
|
+
"pub": "yarn build && yarn publish --access public",
|
|
34
|
+
"test": "testament test"
|
|
39
35
|
},
|
|
40
36
|
"dependencies": {
|
|
41
|
-
"@thi.ng/api": "^
|
|
42
|
-
"@thi.ng/errors": "^
|
|
43
|
-
"@thi.ng/hex": "^
|
|
44
|
-
"@thi.ng/memoize": "^
|
|
37
|
+
"@thi.ng/api": "^8.0.4",
|
|
38
|
+
"@thi.ng/errors": "^2.0.4",
|
|
39
|
+
"@thi.ng/hex": "^2.0.4",
|
|
40
|
+
"@thi.ng/memoize": "^3.0.4"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@thi.ng/testament": "^0.1.4"
|
|
45
44
|
},
|
|
46
|
-
"files": [
|
|
47
|
-
"*.js",
|
|
48
|
-
"*.d.ts",
|
|
49
|
-
"lib"
|
|
50
|
-
],
|
|
51
45
|
"keywords": [
|
|
52
46
|
"ansi",
|
|
53
47
|
"composition",
|
|
@@ -75,9 +69,128 @@
|
|
|
75
69
|
"publishConfig": {
|
|
76
70
|
"access": "public"
|
|
77
71
|
},
|
|
78
|
-
"
|
|
72
|
+
"engines": {
|
|
73
|
+
"node": ">=12.7"
|
|
74
|
+
},
|
|
75
|
+
"files": [
|
|
76
|
+
"*.js",
|
|
77
|
+
"*.d.ts"
|
|
78
|
+
],
|
|
79
|
+
"exports": {
|
|
80
|
+
".": {
|
|
81
|
+
"import": "./index.js"
|
|
82
|
+
},
|
|
83
|
+
"./ansi": {
|
|
84
|
+
"import": "./ansi.js"
|
|
85
|
+
},
|
|
86
|
+
"./api": {
|
|
87
|
+
"import": "./api.js"
|
|
88
|
+
},
|
|
89
|
+
"./case": {
|
|
90
|
+
"import": "./case.js"
|
|
91
|
+
},
|
|
92
|
+
"./center": {
|
|
93
|
+
"import": "./center.js"
|
|
94
|
+
},
|
|
95
|
+
"./cursor": {
|
|
96
|
+
"import": "./cursor.js"
|
|
97
|
+
},
|
|
98
|
+
"./entities": {
|
|
99
|
+
"import": "./entities.js"
|
|
100
|
+
},
|
|
101
|
+
"./escape": {
|
|
102
|
+
"import": "./escape.js"
|
|
103
|
+
},
|
|
104
|
+
"./float": {
|
|
105
|
+
"import": "./float.js"
|
|
106
|
+
},
|
|
107
|
+
"./format": {
|
|
108
|
+
"import": "./format.js"
|
|
109
|
+
},
|
|
110
|
+
"./groups": {
|
|
111
|
+
"import": "./groups.js"
|
|
112
|
+
},
|
|
113
|
+
"./hollerith": {
|
|
114
|
+
"import": "./hollerith.js"
|
|
115
|
+
},
|
|
116
|
+
"./initials": {
|
|
117
|
+
"import": "./initials.js"
|
|
118
|
+
},
|
|
119
|
+
"./int": {
|
|
120
|
+
"import": "./int.js"
|
|
121
|
+
},
|
|
122
|
+
"./interpolate": {
|
|
123
|
+
"import": "./interpolate.js"
|
|
124
|
+
},
|
|
125
|
+
"./join": {
|
|
126
|
+
"import": "./join.js"
|
|
127
|
+
},
|
|
128
|
+
"./pad-left": {
|
|
129
|
+
"import": "./pad-left.js"
|
|
130
|
+
},
|
|
131
|
+
"./pad-right": {
|
|
132
|
+
"import": "./pad-right.js"
|
|
133
|
+
},
|
|
134
|
+
"./parse": {
|
|
135
|
+
"import": "./parse.js"
|
|
136
|
+
},
|
|
137
|
+
"./percent": {
|
|
138
|
+
"import": "./percent.js"
|
|
139
|
+
},
|
|
140
|
+
"./radix": {
|
|
141
|
+
"import": "./radix.js"
|
|
142
|
+
},
|
|
143
|
+
"./range": {
|
|
144
|
+
"import": "./range.js"
|
|
145
|
+
},
|
|
146
|
+
"./repeat": {
|
|
147
|
+
"import": "./repeat.js"
|
|
148
|
+
},
|
|
149
|
+
"./ruler": {
|
|
150
|
+
"import": "./ruler.js"
|
|
151
|
+
},
|
|
152
|
+
"./slugify": {
|
|
153
|
+
"import": "./slugify.js"
|
|
154
|
+
},
|
|
155
|
+
"./splice": {
|
|
156
|
+
"import": "./splice.js"
|
|
157
|
+
},
|
|
158
|
+
"./split": {
|
|
159
|
+
"import": "./split.js"
|
|
160
|
+
},
|
|
161
|
+
"./stringify": {
|
|
162
|
+
"import": "./stringify.js"
|
|
163
|
+
},
|
|
164
|
+
"./tabs": {
|
|
165
|
+
"import": "./tabs.js"
|
|
166
|
+
},
|
|
167
|
+
"./trim": {
|
|
168
|
+
"import": "./trim.js"
|
|
169
|
+
},
|
|
170
|
+
"./truncate-left": {
|
|
171
|
+
"import": "./truncate-left.js"
|
|
172
|
+
},
|
|
173
|
+
"./truncate": {
|
|
174
|
+
"import": "./truncate.js"
|
|
175
|
+
},
|
|
176
|
+
"./units": {
|
|
177
|
+
"import": "./units.js"
|
|
178
|
+
},
|
|
179
|
+
"./uuid": {
|
|
180
|
+
"import": "./uuid.js"
|
|
181
|
+
},
|
|
182
|
+
"./vector": {
|
|
183
|
+
"import": "./vector.js"
|
|
184
|
+
},
|
|
185
|
+
"./word-wrap": {
|
|
186
|
+
"import": "./word-wrap.js"
|
|
187
|
+
},
|
|
188
|
+
"./wrap": {
|
|
189
|
+
"import": "./wrap.js"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
79
192
|
"thi.ng": {
|
|
80
193
|
"year": 2015
|
|
81
194
|
},
|
|
82
|
-
"gitHead": "
|
|
195
|
+
"gitHead": "9ff00a103f76cc4917ef3f244132e218f2300a05"
|
|
83
196
|
}
|
package/pad-left.js
CHANGED
package/pad-right.js
CHANGED
package/percent.d.ts
CHANGED
package/radix.d.ts
CHANGED
package/radix.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { U16 as $16, U24 as $24, U32 as $32, U64HL, U8 as $8, } from "@thi.ng/hex";
|
|
2
|
-
import { memoizeJ } from "@thi.ng/memoize";
|
|
3
|
-
import { repeat } from "./repeat";
|
|
2
|
+
import { memoizeJ } from "@thi.ng/memoize/memoizej";
|
|
3
|
+
import { repeat } from "./repeat.js";
|
|
4
4
|
/**
|
|
5
5
|
* Returns a {@link Stringer} which formats given numbers to `radix`, `len` and
|
|
6
6
|
* with optional prefix (not included in `len`).
|
package/repeat.js
CHANGED
package/ruler.js
CHANGED
package/slugify.d.ts
CHANGED
package/splice.js
CHANGED
package/stringify.d.ts
CHANGED
package/tabs.js
CHANGED
package/trim.d.ts
CHANGED
package/trim.js
CHANGED
package/truncate-left.d.ts
CHANGED
package/truncate-left.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { memoizeJ } from "@thi.ng/memoize";
|
|
2
|
-
export const truncateLeft = memoizeJ((n, prefix = "") => (x) => x.length > n
|
|
1
|
+
import { memoizeJ } from "@thi.ng/memoize/memoizej";
|
|
2
|
+
export const truncateLeft = memoizeJ((n, prefix = "") => (x) => x.length > n
|
|
3
|
+
? prefix + x.substr(x.length - n + prefix.length)
|
|
4
|
+
: x);
|
package/truncate.d.ts
CHANGED
package/truncate.js
CHANGED
package/units.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Stringer } from "./api";
|
|
1
|
+
import type { Stringer } from "./api.js";
|
|
2
2
|
declare type UnitDefs = [number, string, number?][];
|
|
3
3
|
export declare const units: (exp: UnitDefs, base: string, prec?: number) => Stringer<number>;
|
|
4
4
|
export declare const bits: Stringer<number>;
|
package/units.js
CHANGED
package/vector.d.ts
CHANGED
package/vector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { memoizeJ } from "@thi.ng/memoize";
|
|
2
|
-
import { float } from "./float";
|
|
1
|
+
import { memoizeJ } from "@thi.ng/memoize/memoizej";
|
|
2
|
+
import { float } from "./float.js";
|
|
3
3
|
/**
|
|
4
4
|
* Higher order formatter for n-D vectors, with each element formatted using
|
|
5
5
|
* `prec` and using optional delimiter and pre/postfixes.
|
package/word-wrap.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IWordSplit, WordWrapOpts } from "./api";
|
|
1
|
+
import type { IWordSplit, WordWrapOpts } from "./api.js";
|
|
2
2
|
/**
|
|
3
3
|
* Internal representation of a single line (for word wrapping purposes). A thin
|
|
4
4
|
* wrapper of individual word and the _logical_ line length (rather than the
|
package/word-wrap.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { lengthAnsi } from "./ansi";
|
|
2
|
-
import { split } from "./split";
|
|
1
|
+
import { lengthAnsi } from "./ansi.js";
|
|
2
|
+
import { split } from "./split.js";
|
|
3
3
|
/**
|
|
4
4
|
* Internal representation of a single line (for word wrapping purposes). A thin
|
|
5
5
|
* wrapper of individual word and the _logical_ line length (rather than the
|
|
@@ -114,7 +114,13 @@ export const wordWrapLine = (line, opts, acc = []) => {
|
|
|
114
114
|
acc.push(new Line());
|
|
115
115
|
return acc;
|
|
116
116
|
}
|
|
117
|
-
const $opts =
|
|
117
|
+
const $opts = {
|
|
118
|
+
width: 80,
|
|
119
|
+
min: 4,
|
|
120
|
+
hard: false,
|
|
121
|
+
splitter: SPLIT_PLAIN,
|
|
122
|
+
...opts,
|
|
123
|
+
};
|
|
118
124
|
for (let word of split(line, opts.delimWord || /\s/g)) {
|
|
119
125
|
const curr = acc[acc.length - 1];
|
|
120
126
|
wrapWord(word, $opts, curr && curr.n > 0 ? curr.n + 1 : 0, acc);
|
package/wrap.d.ts
CHANGED
package/wrap.js
CHANGED