@carto/ps-utils 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +468 -119
- package/dist/index.js.map +1 -1
- package/dist/types/clipboard/copy.d.ts +4 -6
- package/dist/types/colors/carto-palettes/carto-palettes.d.ts +47 -0
- package/dist/types/colors/hex-to-rgba/hex-to-rgba.d.ts +7 -16
- package/dist/types/colors/palette-to-hex/palette-to-hex.d.ts +19 -0
- package/dist/types/colors/rgba-to-hex/rgba-to-hex.d.ts +8 -20
- package/dist/types/debounce/debounce.d.ts +12 -2
- package/dist/types/formatters/constants.d.ts +23 -1
- package/dist/types/formatters/date/format-date.d.ts +13 -8
- package/dist/types/formatters/number/format-number.d.ts +17 -20
- package/dist/types/index.d.ts +14 -11
- package/dist/types/strings/match-text/match-text.d.ts +11 -7
- package/dist/types/strings/match-text/types.d.ts +1 -1
- package/dist/types/strings/normalize/normalize.d.ts +7 -10
- package/dist/types/strings/routes/replace-route.d.ts +11 -15
- package/package.json +7 -3
- package/src/clipboard/copy.test.ts +49 -0
- package/src/clipboard/copy.ts +18 -0
- package/src/colors/carto-palettes/carto-palettes.ts +355 -0
- package/src/colors/hex-to-rgba/hex-to-rgba.test.ts +82 -0
- package/src/colors/hex-to-rgba/hex-to-rgba.ts +67 -0
- package/src/colors/palette-to-hex/palette-to-hex.test.ts +60 -0
- package/src/colors/palette-to-hex/palette-to-hex.ts +45 -0
- package/src/colors/rgba-to-hex/rgba-to-hex.test.ts +34 -0
- package/src/colors/rgba-to-hex/rgba-to-hex.ts +42 -0
- package/src/colors/rgba-to-hex/types.ts +9 -0
- package/src/debounce/debounce.test.ts +21 -0
- package/src/debounce/debounce.ts +29 -0
- package/src/formatters/constants.ts +49 -0
- package/src/formatters/date/format-date.test.ts +36 -0
- package/src/formatters/date/format-date.ts +34 -0
- package/src/formatters/number/format-number.test.ts +49 -0
- package/src/formatters/number/format-number.ts +68 -0
- package/src/index.ts +18 -0
- package/src/strings/match-text/match-text.test.ts +38 -0
- package/src/strings/match-text/match-text.ts +36 -0
- package/src/strings/match-text/types.ts +15 -0
- package/src/strings/normalize/normalize.test.ts +12 -0
- package/src/strings/normalize/normalize.ts +22 -0
- package/src/strings/normalize/types.ts +15 -0
- package/src/strings/routes/replace-route.test.ts +61 -0
- package/src/strings/routes/replace-route.ts +39 -0
- package/src/strings/routes/types.ts +2 -0
- package/dist/types/clipboard/copy.test.d.ts +0 -1
- package/dist/types/colors/hex-to-rgba/hex-to-rgba.test.d.ts +0 -1
- package/dist/types/colors/rgba-to-hex/rgba-to-hex.test.d.ts +0 -1
- package/dist/types/debounce/debounce.test.d.ts +0 -1
- package/dist/types/formatters/date/format-date.test.d.ts +0 -1
- package/dist/types/formatters/number/format-number.test.d.ts +0 -1
- package/dist/types/strings/match-text/match-text.test.d.ts +0 -1
- package/dist/types/strings/normalize/normalize.test.d.ts +0 -1
- package/dist/types/strings/routes/replace-route.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,131 +1,480 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/clipboard/copy.ts
|
|
2
|
+
async function e(e) {
|
|
3
|
+
try {
|
|
4
|
+
await navigator.clipboard.writeText(e);
|
|
5
|
+
} catch (e) {
|
|
6
|
+
throw Error(e);
|
|
7
|
+
}
|
|
7
8
|
}
|
|
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
|
-
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/colors/carto-palettes/carto-palettes.ts
|
|
11
|
+
var t = {
|
|
12
|
+
ag_GrnYl: [
|
|
13
|
+
"#245668",
|
|
14
|
+
"#0F7279",
|
|
15
|
+
"#0D8F81",
|
|
16
|
+
"#39AB7E",
|
|
17
|
+
"#6EC574",
|
|
18
|
+
"#A9DC67",
|
|
19
|
+
"#EDEF5D"
|
|
20
|
+
],
|
|
21
|
+
ag_Sunset: [
|
|
22
|
+
"#4b2991",
|
|
23
|
+
"#872ca2",
|
|
24
|
+
"#c0369d",
|
|
25
|
+
"#ea4f88",
|
|
26
|
+
"#fa7876",
|
|
27
|
+
"#f6a97a",
|
|
28
|
+
"#edd9a3"
|
|
29
|
+
],
|
|
30
|
+
BluGrn: [
|
|
31
|
+
"#c4e6c3",
|
|
32
|
+
"#96d2a4",
|
|
33
|
+
"#6dbc90",
|
|
34
|
+
"#4da284",
|
|
35
|
+
"#36877a",
|
|
36
|
+
"#266b6e",
|
|
37
|
+
"#1d4f60"
|
|
38
|
+
],
|
|
39
|
+
BluYl: [
|
|
40
|
+
"#f7feae",
|
|
41
|
+
"#b7e6a5",
|
|
42
|
+
"#7ccba2",
|
|
43
|
+
"#46aea0",
|
|
44
|
+
"#089099",
|
|
45
|
+
"#00718b",
|
|
46
|
+
"#045275"
|
|
47
|
+
],
|
|
48
|
+
BrwnYl: [
|
|
49
|
+
"#ede5cf",
|
|
50
|
+
"#e0c2a2",
|
|
51
|
+
"#d39c83",
|
|
52
|
+
"#c1766f",
|
|
53
|
+
"#a65461",
|
|
54
|
+
"#813753",
|
|
55
|
+
"#541f3f"
|
|
56
|
+
],
|
|
57
|
+
Burg: [
|
|
58
|
+
"#ffc6c4",
|
|
59
|
+
"#f4a3a8",
|
|
60
|
+
"#e38191",
|
|
61
|
+
"#cc607d",
|
|
62
|
+
"#ad466c",
|
|
63
|
+
"#8b3058",
|
|
64
|
+
"#672044"
|
|
65
|
+
],
|
|
66
|
+
BurgYl: [
|
|
67
|
+
"#fbe6c5",
|
|
68
|
+
"#f5ba98",
|
|
69
|
+
"#ee8a82",
|
|
70
|
+
"#dc7176",
|
|
71
|
+
"#c8586c",
|
|
72
|
+
"#9c3f5d",
|
|
73
|
+
"#70284a"
|
|
74
|
+
],
|
|
75
|
+
DarkMint: [
|
|
76
|
+
"#d2fbd4",
|
|
77
|
+
"#a5dbc2",
|
|
78
|
+
"#7bbcb0",
|
|
79
|
+
"#559c9e",
|
|
80
|
+
"#3a7c89",
|
|
81
|
+
"#235d72",
|
|
82
|
+
"#123f5a"
|
|
83
|
+
],
|
|
84
|
+
Emrld: [
|
|
85
|
+
"#d3f2a3",
|
|
86
|
+
"#97e196",
|
|
87
|
+
"#6cc08b",
|
|
88
|
+
"#4c9b82",
|
|
89
|
+
"#217a79",
|
|
90
|
+
"#105965",
|
|
91
|
+
"#074050"
|
|
92
|
+
],
|
|
93
|
+
Magenta: [
|
|
94
|
+
"#f3cbd3",
|
|
95
|
+
"#eaa9bd",
|
|
96
|
+
"#dd88ac",
|
|
97
|
+
"#ca699d",
|
|
98
|
+
"#b14d8e",
|
|
99
|
+
"#91357d",
|
|
100
|
+
"#6c2167"
|
|
101
|
+
],
|
|
102
|
+
Mint: [
|
|
103
|
+
"#e4f1e1",
|
|
104
|
+
"#b4d9cc",
|
|
105
|
+
"#89c0b6",
|
|
106
|
+
"#63a6a0",
|
|
107
|
+
"#448c8a",
|
|
108
|
+
"#287274",
|
|
109
|
+
"#0d585f"
|
|
110
|
+
],
|
|
111
|
+
OrYel: [
|
|
112
|
+
"#ecda9a",
|
|
113
|
+
"#efc47e",
|
|
114
|
+
"#f3ad6a",
|
|
115
|
+
"#f7945d",
|
|
116
|
+
"#f97b57",
|
|
117
|
+
"#f66356",
|
|
118
|
+
"#ee4d5a"
|
|
119
|
+
],
|
|
120
|
+
Peach: [
|
|
121
|
+
"#fde0c5",
|
|
122
|
+
"#facba6",
|
|
123
|
+
"#f8b58b",
|
|
124
|
+
"#f59e72",
|
|
125
|
+
"#f2855d",
|
|
126
|
+
"#ef6a4c",
|
|
127
|
+
"#eb4a40"
|
|
128
|
+
],
|
|
129
|
+
PinkYl: [
|
|
130
|
+
"#fef6b5",
|
|
131
|
+
"#ffdd9a",
|
|
132
|
+
"#ffc285",
|
|
133
|
+
"#ffa679",
|
|
134
|
+
"#fa8a76",
|
|
135
|
+
"#f16d7a",
|
|
136
|
+
"#e15383"
|
|
137
|
+
],
|
|
138
|
+
Purp: [
|
|
139
|
+
"#f3e0f7",
|
|
140
|
+
"#e4c7f1",
|
|
141
|
+
"#d1afe8",
|
|
142
|
+
"#b998dd",
|
|
143
|
+
"#9f82ce",
|
|
144
|
+
"#826dba",
|
|
145
|
+
"#63589f"
|
|
146
|
+
],
|
|
147
|
+
PurpOr: [
|
|
148
|
+
"#f9ddda",
|
|
149
|
+
"#f2b9c4",
|
|
150
|
+
"#e597b9",
|
|
151
|
+
"#ce78b3",
|
|
152
|
+
"#ad5fad",
|
|
153
|
+
"#834ba0",
|
|
154
|
+
"#573b88"
|
|
155
|
+
],
|
|
156
|
+
RedOr: [
|
|
157
|
+
"#f6d2a9",
|
|
158
|
+
"#f5b78e",
|
|
159
|
+
"#f19c7c",
|
|
160
|
+
"#ea8171",
|
|
161
|
+
"#dd686c",
|
|
162
|
+
"#ca5268",
|
|
163
|
+
"#b13f64"
|
|
164
|
+
],
|
|
165
|
+
Sunset: [
|
|
166
|
+
"#f3e79b",
|
|
167
|
+
"#fac484",
|
|
168
|
+
"#f8a07e",
|
|
169
|
+
"#eb7f86",
|
|
170
|
+
"#ce6693",
|
|
171
|
+
"#a059a0",
|
|
172
|
+
"#5c53a5"
|
|
173
|
+
],
|
|
174
|
+
SunsetDark: [
|
|
175
|
+
"#fcde9c",
|
|
176
|
+
"#faa476",
|
|
177
|
+
"#f0746e",
|
|
178
|
+
"#e34f6f",
|
|
179
|
+
"#dc3977",
|
|
180
|
+
"#b9257a",
|
|
181
|
+
"#7c1d6f"
|
|
182
|
+
],
|
|
183
|
+
Teal: [
|
|
184
|
+
"#d1eeea",
|
|
185
|
+
"#a8dbd9",
|
|
186
|
+
"#85c4c9",
|
|
187
|
+
"#68abb8",
|
|
188
|
+
"#4f90a6",
|
|
189
|
+
"#3b738f",
|
|
190
|
+
"#2a5674"
|
|
191
|
+
],
|
|
192
|
+
TealGrn: [
|
|
193
|
+
"#b0f2bc",
|
|
194
|
+
"#89e8ac",
|
|
195
|
+
"#67dba5",
|
|
196
|
+
"#4cc8a3",
|
|
197
|
+
"#38b2a3",
|
|
198
|
+
"#2c98a0",
|
|
199
|
+
"#257d98"
|
|
200
|
+
],
|
|
201
|
+
ArmyRose: [
|
|
202
|
+
"#798234",
|
|
203
|
+
"#a3ad62",
|
|
204
|
+
"#d0d3a2",
|
|
205
|
+
"#fdfbe4",
|
|
206
|
+
"#f0c6c3",
|
|
207
|
+
"#df91a3",
|
|
208
|
+
"#d46780"
|
|
209
|
+
],
|
|
210
|
+
Earth: [
|
|
211
|
+
"#A16928",
|
|
212
|
+
"#bd925a",
|
|
213
|
+
"#d6bd8d",
|
|
214
|
+
"#edeac2",
|
|
215
|
+
"#b5c8b8",
|
|
216
|
+
"#79a7ac",
|
|
217
|
+
"#2887a1"
|
|
218
|
+
],
|
|
219
|
+
Fall: [
|
|
220
|
+
"#3d5941",
|
|
221
|
+
"#778868",
|
|
222
|
+
"#b5b991",
|
|
223
|
+
"#f6edbd",
|
|
224
|
+
"#edbb8a",
|
|
225
|
+
"#de8a5a",
|
|
226
|
+
"#ca562c"
|
|
227
|
+
],
|
|
228
|
+
Geyser: [
|
|
229
|
+
"#008080",
|
|
230
|
+
"#70a494",
|
|
231
|
+
"#b4c8a8",
|
|
232
|
+
"#f6edbd",
|
|
233
|
+
"#edbb8a",
|
|
234
|
+
"#de8a5a",
|
|
235
|
+
"#ca562c"
|
|
236
|
+
],
|
|
237
|
+
TealRose: [
|
|
238
|
+
"#009392",
|
|
239
|
+
"#72aaa1",
|
|
240
|
+
"#b1c7b3",
|
|
241
|
+
"#f1eac8",
|
|
242
|
+
"#e5b9ad",
|
|
243
|
+
"#d98994",
|
|
244
|
+
"#d0587e"
|
|
245
|
+
],
|
|
246
|
+
Temps: [
|
|
247
|
+
"#009392",
|
|
248
|
+
"#39b185",
|
|
249
|
+
"#9ccb86",
|
|
250
|
+
"#e9e29c",
|
|
251
|
+
"#eeb479",
|
|
252
|
+
"#e88471",
|
|
253
|
+
"#cf597e"
|
|
254
|
+
],
|
|
255
|
+
Tropic: [
|
|
256
|
+
"#009B9E",
|
|
257
|
+
"#42B7B9",
|
|
258
|
+
"#A7D3D4",
|
|
259
|
+
"#F1F1F1",
|
|
260
|
+
"#E4C1D9",
|
|
261
|
+
"#D691C1",
|
|
262
|
+
"#C75DAB"
|
|
263
|
+
],
|
|
264
|
+
Antique: [
|
|
265
|
+
"#855C75",
|
|
266
|
+
"#D9AF6B",
|
|
267
|
+
"#AF6458",
|
|
268
|
+
"#736F4C",
|
|
269
|
+
"#526A83",
|
|
270
|
+
"#625377",
|
|
271
|
+
"#68855C",
|
|
272
|
+
"#9C9C5E",
|
|
273
|
+
"#A06177",
|
|
274
|
+
"#8C785D",
|
|
275
|
+
"#467378",
|
|
276
|
+
"#7C7C7C"
|
|
277
|
+
],
|
|
278
|
+
Bold: [
|
|
279
|
+
"#7F3C8D",
|
|
280
|
+
"#11A579",
|
|
281
|
+
"#3969AC",
|
|
282
|
+
"#F2B701",
|
|
283
|
+
"#E73F74",
|
|
284
|
+
"#80BA5A",
|
|
285
|
+
"#E68310",
|
|
286
|
+
"#008695",
|
|
287
|
+
"#CF1C90",
|
|
288
|
+
"#f97b72",
|
|
289
|
+
"#4b4b8f",
|
|
290
|
+
"#A5AA99"
|
|
291
|
+
],
|
|
292
|
+
Pastel: [
|
|
293
|
+
"#66C5CC",
|
|
294
|
+
"#F6CF71",
|
|
295
|
+
"#F89C74",
|
|
296
|
+
"#DCB0F2",
|
|
297
|
+
"#87C55F",
|
|
298
|
+
"#9EB9F3",
|
|
299
|
+
"#FE88B1",
|
|
300
|
+
"#C9DB74",
|
|
301
|
+
"#8BE0A4",
|
|
302
|
+
"#B497E7",
|
|
303
|
+
"#D3B484",
|
|
304
|
+
"#B3B3B3"
|
|
305
|
+
],
|
|
306
|
+
Prism: [
|
|
307
|
+
"#5F4690",
|
|
308
|
+
"#1D6996",
|
|
309
|
+
"#38A6A5",
|
|
310
|
+
"#0F8554",
|
|
311
|
+
"#73AF48",
|
|
312
|
+
"#EDAD08",
|
|
313
|
+
"#E17C05",
|
|
314
|
+
"#CC503E",
|
|
315
|
+
"#94346E",
|
|
316
|
+
"#6F4070",
|
|
317
|
+
"#994E95",
|
|
318
|
+
"#666666"
|
|
319
|
+
],
|
|
320
|
+
Safe: [
|
|
321
|
+
"#88CCEE",
|
|
322
|
+
"#CC6677",
|
|
323
|
+
"#DDCC77",
|
|
324
|
+
"#117733",
|
|
325
|
+
"#332288",
|
|
326
|
+
"#AA4499",
|
|
327
|
+
"#44AA99",
|
|
328
|
+
"#999933",
|
|
329
|
+
"#882255",
|
|
330
|
+
"#661100",
|
|
331
|
+
"#6699CC",
|
|
332
|
+
"#888888"
|
|
333
|
+
],
|
|
334
|
+
Vivid: [
|
|
335
|
+
"#E58606",
|
|
336
|
+
"#5D69B1",
|
|
337
|
+
"#52BCA3",
|
|
338
|
+
"#99C945",
|
|
339
|
+
"#CC61B0",
|
|
340
|
+
"#24796C",
|
|
341
|
+
"#DAA51B",
|
|
342
|
+
"#2F8AC4",
|
|
343
|
+
"#764E9F",
|
|
344
|
+
"#ED645A",
|
|
345
|
+
"#CC3A8E",
|
|
346
|
+
"#A5AA99"
|
|
347
|
+
]
|
|
348
|
+
};
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/colors/hex-to-rgba/hex-to-rgba.ts
|
|
351
|
+
function n(e, t = 1) {
|
|
352
|
+
if (!e) {
|
|
353
|
+
console.warn(`hexToRgba: ${e} invalid hexadecimal format`);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
if (t < 0 || t > 1) {
|
|
357
|
+
console.warn(`hexToRgba: ${t} invalid alpha format`);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (e?.includes("#") && (e = e.slice(1)), !/[0-9A-Fa-f]{6}/g.test(e) && !/[0-9A-Fa-f]{3}/g.test(e) && !/[0-9A-Fa-f]{2}/g.test(e)) {
|
|
361
|
+
console.warn(`hexToRgba: ${e} invalid hexadecimal format`);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
let n = e.length;
|
|
365
|
+
return n < 6 && (e = e.slice(0, 6 - n).repeat(6 / n)), [
|
|
366
|
+
parseInt(e.length === 3 ? e.slice(0, 1).repeat(2) : e.slice(0, 2), 16),
|
|
367
|
+
parseInt(e.length === 3 ? e.slice(1, 2).repeat(2) : e.slice(2, 4), 16),
|
|
368
|
+
parseInt(e.length === 3 ? e.slice(2, 3).repeat(2) : e.slice(4, 6), 16),
|
|
369
|
+
t * 255
|
|
370
|
+
];
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/colors/palette-to-hex/palette-to-hex.ts
|
|
374
|
+
var r = new Map(Object.entries(t).map(([e, t]) => [e.toLowerCase(), t]));
|
|
375
|
+
function i(e) {
|
|
376
|
+
let t = r.get(e.toLowerCase());
|
|
377
|
+
if (!t) {
|
|
378
|
+
console.warn(`paletteToHex: ${e} unknown palette`);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
return t.slice();
|
|
34
382
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/colors/rgba-to-hex/rgba-to-hex.ts
|
|
385
|
+
function a(e, { withPrefix: t = !0 } = {}) {
|
|
386
|
+
if (!e?.length) {
|
|
387
|
+
console.warn("rgbaToHex: invalid array or empty values");
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
if (e.some((e) => e < 0 || e > 255)) {
|
|
391
|
+
console.warn(`rgbaToHex: [${e.toString()}] invalid array value format`);
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
let n = e.map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
395
|
+
return `${t ? "#" : ""}${n}`;
|
|
46
396
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
397
|
+
//#endregion
|
|
398
|
+
//#region src/debounce/debounce.ts
|
|
399
|
+
function o(e, t) {
|
|
400
|
+
let n;
|
|
401
|
+
return (...r) => {
|
|
402
|
+
clearTimeout(n), n = setTimeout(() => e(...r), t);
|
|
403
|
+
};
|
|
51
404
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/formatters/constants.ts
|
|
407
|
+
var s = {
|
|
408
|
+
NUMBER: {
|
|
409
|
+
style: "decimal",
|
|
410
|
+
maximumFractionDigits: 1,
|
|
411
|
+
minimumFractionDigits: 0,
|
|
412
|
+
notation: "compact",
|
|
413
|
+
compactDisplay: "short"
|
|
414
|
+
},
|
|
415
|
+
CURRENCY: {
|
|
416
|
+
style: "currency",
|
|
417
|
+
currency: "USD",
|
|
418
|
+
maximumFractionDigits: 2,
|
|
419
|
+
minimumFractionDigits: 2,
|
|
420
|
+
notation: "compact",
|
|
421
|
+
compactDisplay: "short"
|
|
422
|
+
},
|
|
423
|
+
DATE: {
|
|
424
|
+
year: "numeric",
|
|
425
|
+
month: "2-digit",
|
|
426
|
+
day: "2-digit"
|
|
427
|
+
}
|
|
73
428
|
};
|
|
74
|
-
|
|
75
|
-
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/formatters/date/format-date.ts
|
|
431
|
+
function c(e, t, n = {}) {
|
|
432
|
+
let r = n.dateStyle !== void 0 || n.timeStyle !== void 0 ? n : {
|
|
433
|
+
...s.DATE,
|
|
434
|
+
...n
|
|
435
|
+
};
|
|
436
|
+
return Intl.DateTimeFormat(t, r).format(e);
|
|
76
437
|
}
|
|
77
|
-
|
|
78
|
-
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/formatters/number/format-number.ts
|
|
440
|
+
function l(e, t, n) {
|
|
441
|
+
return Intl.NumberFormat(t, n).format(e);
|
|
79
442
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
443
|
+
function u(e, t, n = {}) {
|
|
444
|
+
return l(e, t, {
|
|
445
|
+
...s.NUMBER,
|
|
446
|
+
...n
|
|
447
|
+
});
|
|
85
448
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
449
|
+
function d(e, t, n = {}) {
|
|
450
|
+
return l(e, t, {
|
|
451
|
+
...s.CURRENCY,
|
|
452
|
+
...n
|
|
453
|
+
});
|
|
91
454
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region src/strings/normalize/normalize.ts
|
|
457
|
+
function f(e, { format: t = "NFD", replaceUnicode: n = "[̀-ͯ]" } = {}) {
|
|
458
|
+
let r = new RegExp(n, "g");
|
|
459
|
+
return e.normalize(t).replace(r, "");
|
|
95
460
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}) : u(n).match(o) ? n : null;
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/strings/match-text/match-text.ts
|
|
463
|
+
function p(e, t, { matchFn: n, normalizeOptions: r } = {}) {
|
|
464
|
+
let i = e;
|
|
465
|
+
return typeof e == "string" && (i = new RegExp(f(e.toLowerCase(), r), "gi")), Array.isArray(t) ? t.filter((e) => f(n ? n(e) : e).match(i)) : f(t).match(i) ? t : null;
|
|
102
466
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const g = i.substring(1);
|
|
113
|
-
s = n[g];
|
|
114
|
-
}
|
|
115
|
-
r = r.replace(i, (s == null ? void 0 : s.toString()) ?? "");
|
|
116
|
-
}), r;
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/strings/routes/replace-route.ts
|
|
469
|
+
var m = /:+[a-z]+/gi;
|
|
470
|
+
function h(e, t = []) {
|
|
471
|
+
let n = e, r = n.match(m) ?? [], i = Array.isArray(t);
|
|
472
|
+
return r.forEach((e, r) => {
|
|
473
|
+
let a;
|
|
474
|
+
a = i ? t[r] : t[e.substring(1)], n = n.replace(e, a?.toString() ?? "");
|
|
475
|
+
}), n;
|
|
117
476
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
D as formatCurrency,
|
|
123
|
-
R as formatDate,
|
|
124
|
-
w as formatNumber,
|
|
125
|
-
p as hexToRgba,
|
|
126
|
-
F as matchText,
|
|
127
|
-
u as normalize,
|
|
128
|
-
A as replaceRoute,
|
|
129
|
-
y as rgbaToHex
|
|
130
|
-
};
|
|
131
|
-
//# sourceMappingURL=index.js.map
|
|
477
|
+
//#endregion
|
|
478
|
+
export { t as CARTO_PALETTES, s as DEFAULT_FORMATTERS_CONFIG, e as copy, o as debounce, d as formatCurrency, c as formatDate, u as formatNumber, n as hexToRgba, p as matchText, f as normalize, i as paletteToHex, h as replaceRoute, a as rgbaToHex };
|
|
479
|
+
|
|
480
|
+
//# sourceMappingURL=index.js.map
|