@warp-drive/utilities 5.6.0-alpha.11 → 5.6.0-alpha.13

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.
@@ -0,0 +1,463 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const DEFAULT_MAX_CACHE_SIZE = 10_000;
6
+
7
+ /**
8
+ * An LRUCache implementation with upsert semantics.
9
+ *
10
+ * This implementation is *not* generic, but focuses on
11
+ * performance tuning for the string transformation cases
12
+ * where the key maps to the value very simply.
13
+ *
14
+ * It takes a work function that should generate a new value
15
+ * for a given key when called. It will be called when the key
16
+ * is not found in the cache.
17
+ *
18
+ * It keeps track of the number of hits, misses, and ejections
19
+ * in DEBUG envs, which is useful for tuning the cache size.
20
+ *
21
+ * This is an internal utility class for use by this module
22
+ * and by `@warp-drive/utilities/string`. It is not intended
23
+ * for use outside of these modules at this time.
24
+ *
25
+ * @internal
26
+ */
27
+ class LRUCache {
28
+ // debug stats
29
+
30
+ constructor(doWork, size) {
31
+ this.size = size || DEFAULT_MAX_CACHE_SIZE;
32
+ this.state = new Map();
33
+ this.doWork = doWork;
34
+ }
35
+ get(key) {
36
+ const value = this.state.get(key);
37
+ if (value) {
38
+ this.state.delete(key);
39
+ this.state.set(key, value);
40
+ return value;
41
+ }
42
+ const newValue = this.doWork(key);
43
+ this.set(key, newValue);
44
+ return newValue;
45
+ }
46
+ set(key, value) {
47
+ if (this.state.size === this.size) {
48
+ for (const [k] of this.state) {
49
+ this.state.delete(k);
50
+ break;
51
+ }
52
+ }
53
+ this.state.set(key, value);
54
+ }
55
+ clear() {
56
+ this.state.clear();
57
+ }
58
+ }
59
+ const STRING_DASHERIZE_REGEXP = /[ _]/g;
60
+ const STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
61
+ const STRING_DASHERIZE_CACHE = new LRUCache(key => key.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase().replace(STRING_DASHERIZE_REGEXP, '-'));
62
+
63
+ /**
64
+ * This is an internal utility function that converts a string
65
+ * to a dasherized format. Library consumers should use the
66
+ * re-exported version from `@warp-drive/utilities/string` instead.
67
+ *
68
+ * This version is only in this location to support a deprecated
69
+ * behavior in the core package and will be removed in a future.
70
+ *
71
+ * @internal
72
+ */
73
+ function dasherize$1(str) {
74
+ return STRING_DASHERIZE_CACHE.get(str);
75
+ }
76
+
77
+ const defaultRules = {
78
+ plurals: [[/$/, 's'], [/s$/i, 's'], [/^(ax|test)is$/i, '$1es'], [/(octop|vir)us$/i, '$1i'], [/(octop|vir)i$/i, '$1i'], [/(alias|status|bonus)$/i, '$1es'], [/(bu)s$/i, '$1ses'], [/(buffal|tomat)o$/i, '$1oes'], [/([ti])um$/i, '$1a'], [/([ti])a$/i, '$1a'], [/sis$/i, 'ses'], [/(?:([^f])fe|([lr])f)$/i, '$1$2ves'], [/(hive)$/i, '$1s'], [/([^aeiouy]|qu)y$/i, '$1ies'], [/(x|ch|ss|sh)$/i, '$1es'], [/(matr|vert|ind)(?:ix|ex)$/i, '$1ices'], [/^(m|l)ouse$/i, '$1ice'], [/^(m|l)ice$/i, '$1ice'], [/^(ox)$/i, '$1en'], [/^(oxen)$/i, '$1'], [/(quiz)$/i, '$1zes']],
79
+ singular: [[/s$/i, ''], [/(ss)$/i, '$1'], [/(n)ews$/i, '$1ews'], [/([ti])a$/i, '$1um'], [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '$1sis'], [/(^analy)(sis|ses)$/i, '$1sis'], [/([^f])ves$/i, '$1fe'], [/(hive)s$/i, '$1'], [/(tive)s$/i, '$1'], [/([lr])ves$/i, '$1f'], [/([^aeiouy]|qu)ies$/i, '$1y'], [/(s)eries$/i, '$1eries'], [/(m)ovies$/i, '$1ovie'], [/(x|ch|ss|sh)es$/i, '$1'], [/^(m|l)ice$/i, '$1ouse'], [/(bus)(es)?$/i, '$1'], [/(o)es$/i, '$1'], [/(shoe)s$/i, '$1'], [/(cris|test)(is|es)$/i, '$1is'], [/^(a)x[ie]s$/i, '$1xis'], [/(octop|vir)(us|i)$/i, '$1us'], [/(alias|status|bonus)(es)?$/i, '$1'], [/^(ox)en/i, '$1'], [/(vert|ind)ices$/i, '$1ex'], [/(matr)ices$/i, '$1ix'], [/(quiz)zes$/i, '$1'], [/(database)s$/i, '$1']],
80
+ irregularPairs: [['person', 'people'], ['man', 'men'], ['child', 'children'], ['sex', 'sexes'], ['move', 'moves'], ['cow', 'kine'], ['zombie', 'zombies']],
81
+ uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police']
82
+ };
83
+
84
+ // eslint-disable-next-line no-useless-escape
85
+ const STRING_CAMELIZE_REGEXP_1 = /(\-|\_|\.|\s)+(.)?/g;
86
+ const STRING_CAMELIZE_REGEXP_2 = /(^|\/)([A-Z])/g;
87
+ const CAMELIZE_CACHE = new LRUCache(key => key.replace(STRING_CAMELIZE_REGEXP_1, (_match, _separator, chr) => chr ? chr.toUpperCase() : '').replace(STRING_CAMELIZE_REGEXP_2, (match /*, separator, chr */) => match.toLowerCase()));
88
+ const STRING_UNDERSCORE_REGEXP_1 = /([a-z\d])([A-Z]+)/g;
89
+ // eslint-disable-next-line no-useless-escape
90
+ const STRING_UNDERSCORE_REGEXP_2 = /\-|\s+/g;
91
+ const UNDERSCORE_CACHE = new LRUCache(str => str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase());
92
+ const STRING_CAPITALIZE_REGEXP = /(^|\/)([a-z\u00C0-\u024F])/g;
93
+ const CAPITALIZE_CACHE = new LRUCache(str => str.replace(STRING_CAPITALIZE_REGEXP, (match /*, separator, chr */) => match.toUpperCase()));
94
+
95
+ /**
96
+ * Replaces underscores, spaces, or camelCase with dashes.
97
+ *
98
+ * ```js
99
+ * import { dasherize } from '@warp-drive/utilities/string';
100
+ *
101
+ * dasherize('innerHTML'); // 'inner-html'
102
+ * dasherize('action_name'); // 'action-name'
103
+ * dasherize('css-class-name'); // 'css-class-name'
104
+ * dasherize('my favorite items'); // 'my-favorite-items'
105
+ * dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'
106
+ * ```
107
+ *
108
+ * @public
109
+ * @param {String} str
110
+ * @return {String}
111
+ * @since 4.13.0
112
+ */
113
+ const dasherize = dasherize$1;
114
+
115
+ /**
116
+ * Returns the lowerCamelCase form of a string.
117
+ *
118
+ * ```js
119
+ * import { camelize } from '@warp-drive/utilities/string';
120
+ *
121
+ * camelize('innerHTML'); // 'innerHTML'
122
+ * camelize('action_name'); // 'actionName'
123
+ * camelize('css-class-name'); // 'cssClassName'
124
+ * camelize('my favorite items'); // 'myFavoriteItems'
125
+ * camelize('My Favorite Items'); // 'myFavoriteItems'
126
+ * camelize('private-docs/owner-invoice'); // 'privateDocs/ownerInvoice'
127
+ * ```
128
+ *
129
+ * @public
130
+ * @param {String} str
131
+ * @return {String}
132
+ * @since 4.13.0
133
+ */
134
+ function camelize(str) {
135
+ return CAMELIZE_CACHE.get(str);
136
+ }
137
+
138
+ /**
139
+ * Returns the lower\_case\_and\_underscored form of a string.
140
+ *
141
+ * ```js
142
+ * import { underscore } from '@warp-drive/utilities/string';
143
+ *
144
+ * underscore('innerHTML'); // 'inner_html'
145
+ * underscore('action_name'); // 'action_name'
146
+ * underscore('css-class-name'); // 'css_class_name'
147
+ * underscore('my favorite items'); // 'my_favorite_items'
148
+ * underscore('privateDocs/ownerInvoice'); // 'private_docs/owner_invoice'
149
+ * ```
150
+ *
151
+ * @public
152
+ * @param {String} str
153
+ * @return {String}
154
+ * @since 4.13.0
155
+ */
156
+ function underscore(str) {
157
+ return UNDERSCORE_CACHE.get(str);
158
+ }
159
+
160
+ /**
161
+ * Returns the Capitalized form of a string
162
+ *
163
+ * ```js
164
+ * import { capitalize } from '@warp-drive/utilities/string';
165
+ *
166
+ * capitalize('innerHTML') // 'InnerHTML'
167
+ * capitalize('action_name') // 'Action_name'
168
+ * capitalize('css-class-name') // 'Css-class-name'
169
+ * capitalize('my favorite items') // 'My favorite items'
170
+ * capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'
171
+ * ```
172
+ *
173
+ * @public
174
+ * @param {String} str
175
+ * @return {String}
176
+ * @since 4.13.0
177
+ */
178
+ function capitalize(str) {
179
+ return CAPITALIZE_CACHE.get(str);
180
+ }
181
+
182
+ /**
183
+ * Sets the maximum size of the LRUCache for all string transformation functions.
184
+ * The default size is 10,000.
185
+ *
186
+ * @public
187
+ * @param {Number} size
188
+ * @return {void}
189
+ * @since 4.13.0
190
+ */
191
+ function setMaxLRUCacheSize(size) {
192
+ CAMELIZE_CACHE.size = size;
193
+ UNDERSCORE_CACHE.size = size;
194
+ CAPITALIZE_CACHE.size = size;
195
+ STRING_DASHERIZE_CACHE.size = size;
196
+ }
197
+
198
+ const BLANK_REGEX = /^\s*$/;
199
+ const LAST_WORD_DASHED_REGEX = /([\w/-]+[_/\s-])([a-z\d]+$)/;
200
+ const LAST_WORD_CAMELIZED_REGEX = /([\w/\s-]+)([A-Z][a-z\d]*$)/;
201
+ const CAMELIZED_REGEX = /[A-Z][a-z\d]*$/;
202
+ const SINGULARS = new LRUCache(word => {
203
+ return _singularize(word);
204
+ });
205
+ const PLURALS = new LRUCache(word => {
206
+ return _pluralize(word);
207
+ });
208
+ const UNCOUNTABLE = new Set(defaultRules.uncountable);
209
+ const IRREGULAR = new Map();
210
+ const INVERSE_IRREGULAR = new Map();
211
+ const SINGULAR_RULES = new Map(defaultRules.singular.reverse());
212
+ const PLURAL_RULES = new Map(defaultRules.plurals.reverse());
213
+
214
+ /**
215
+ * Marks a word as uncountable. Uncountable words are not pluralized
216
+ * or singularized.
217
+ *
218
+ * @public
219
+ * @param {String} word
220
+ * @return {void}
221
+ * @since 4.13.0
222
+ */
223
+ function uncountable(word) {
224
+ UNCOUNTABLE.add(word.toLowerCase());
225
+ }
226
+
227
+ /**
228
+ * Marks a list of words as uncountable. Uncountable words are not pluralized
229
+ * or singularized.
230
+ *
231
+ * @public
232
+ * @param {Array<String>} uncountables
233
+ * @return {void}
234
+ * @since 4.13.0
235
+ */
236
+ function loadUncountable(uncountables) {
237
+ uncountables.forEach(word => {
238
+ uncountable(word);
239
+ });
240
+ }
241
+
242
+ /**
243
+ * Marks a word as irregular. Irregular words have unique
244
+ * pluralization and singularization rules.
245
+ *
246
+ * @public
247
+ * @param {String} single
248
+ * @param {String} plur
249
+ * @return {void}
250
+ * @since 4.13.0
251
+ */
252
+ function irregular(single, plur) {
253
+ //pluralizing
254
+ IRREGULAR.set(single.toLowerCase(), plur);
255
+ IRREGULAR.set(plur.toLowerCase(), plur);
256
+
257
+ //singularizing
258
+ INVERSE_IRREGULAR.set(plur.toLowerCase(), single);
259
+ INVERSE_IRREGULAR.set(single.toLowerCase(), single);
260
+ }
261
+
262
+ /**
263
+ * Marks a list of word pairs as irregular. Irregular words have unique
264
+ * pluralization and singularization rules.
265
+ *
266
+ * @public
267
+ * @param {Array<Array<String>>} irregularPairs
268
+ * @return {void}
269
+ * @since 4.13.0
270
+ */
271
+ function loadIrregular(irregularPairs) {
272
+ irregularPairs.forEach(pair => {
273
+ //pluralizing
274
+ IRREGULAR.set(pair[0].toLowerCase(), pair[1]);
275
+ IRREGULAR.set(pair[1].toLowerCase(), pair[1]);
276
+
277
+ //singularizing
278
+ INVERSE_IRREGULAR.set(pair[1].toLowerCase(), pair[0]);
279
+ INVERSE_IRREGULAR.set(pair[0].toLowerCase(), pair[0]);
280
+ });
281
+ }
282
+ loadIrregular(defaultRules.irregularPairs);
283
+
284
+ /**
285
+ * Clears the caches for singularize and pluralize.
286
+ *
287
+ * @public
288
+ * @return {void}
289
+ * @since 4.13.0
290
+ */
291
+ function clear() {
292
+ SINGULARS.clear();
293
+ PLURALS.clear();
294
+ }
295
+
296
+ /**
297
+ * Resets the inflection rules to the defaults.
298
+ *
299
+ * @public
300
+ * @return {void}
301
+ * @since 4.13.0
302
+ */
303
+ function resetToDefaults() {
304
+ clearRules();
305
+ defaultRules.uncountable.forEach(v => UNCOUNTABLE.add(v));
306
+ defaultRules.singular.forEach(v => SINGULAR_RULES.set(v[0], v[1]));
307
+ defaultRules.plurals.forEach(v => PLURAL_RULES.set(v[0], v[1]));
308
+ loadIrregular(defaultRules.irregularPairs);
309
+ }
310
+
311
+ /**
312
+ * Clears all inflection rules
313
+ * and resets the caches for singularize and pluralize.
314
+ *
315
+ * @public
316
+ * @return {void}
317
+ * @since 4.13.0
318
+ */
319
+ function clearRules() {
320
+ SINGULARS.clear();
321
+ PLURALS.clear();
322
+ UNCOUNTABLE.clear();
323
+ IRREGULAR.clear();
324
+ INVERSE_IRREGULAR.clear();
325
+ SINGULAR_RULES.clear();
326
+ PLURAL_RULES.clear();
327
+ }
328
+
329
+ /**
330
+ * Singularizes a word.
331
+ *
332
+ * @public
333
+ * @param {String} word
334
+ * @return {String}
335
+ * @since 4.13.0
336
+ */
337
+ function singularize(word) {
338
+ if (!word) return '';
339
+ return SINGULARS.get(word);
340
+ }
341
+
342
+ /**
343
+ * Pluralizes a word.
344
+ *
345
+ * @public
346
+ * @param {String} word
347
+ * @return {String}
348
+ * @since 4.13.0
349
+ */
350
+ function pluralize(word) {
351
+ if (!word) return '';
352
+ return PLURALS.get(word);
353
+ }
354
+ function unshiftMap(v, map) {
355
+ // reorder
356
+ const rules = [v, ...map.entries()];
357
+ map.clear();
358
+ rules.forEach(rule => {
359
+ map.set(rule[0], rule[1]);
360
+ });
361
+ }
362
+
363
+ /**
364
+ * Adds a pluralization rule.
365
+ *
366
+ * @public
367
+ * @param {RegExp} regex
368
+ * @param {String} string
369
+ * @return {void}
370
+ * @since 4.13.0
371
+ */
372
+ function plural(regex, string) {
373
+ // rule requires reordering if exists, so remove it first
374
+ if (PLURAL_RULES.has(regex)) {
375
+ PLURAL_RULES.delete(regex);
376
+ }
377
+
378
+ // reorder
379
+ unshiftMap([regex, string], PLURAL_RULES);
380
+ }
381
+
382
+ /**
383
+ * Adds a singularization rule.
384
+ *
385
+ * @public
386
+ * @param {RegExp} regex
387
+ * @param {String} string
388
+ * @return {void}
389
+ * @since 4.13.0
390
+ */
391
+ function singular(regex, string) {
392
+ // rule requires reordering if exists, so remove it first
393
+ if (SINGULAR_RULES.has(regex)) {
394
+ SINGULAR_RULES.delete(regex);
395
+ }
396
+
397
+ // reorder
398
+ unshiftMap([regex, string], SINGULAR_RULES);
399
+ }
400
+ function _pluralize(word) {
401
+ return inflect(word, PLURAL_RULES, IRREGULAR);
402
+ }
403
+ function _singularize(word) {
404
+ return inflect(word, SINGULAR_RULES, INVERSE_IRREGULAR);
405
+ }
406
+ function inflect(word, typeRules, irregulars) {
407
+ // empty strings
408
+ const isBlank = !word || BLANK_REGEX.test(word);
409
+ if (isBlank) {
410
+ return word;
411
+ }
412
+
413
+ // basic uncountables
414
+ const lowercase = word.toLowerCase();
415
+ if (UNCOUNTABLE.has(lowercase)) {
416
+ return word;
417
+ }
418
+
419
+ // adv uncountables
420
+ const wordSplit = LAST_WORD_DASHED_REGEX.exec(word) || LAST_WORD_CAMELIZED_REGEX.exec(word);
421
+ const lastWord = wordSplit ? wordSplit[2].toLowerCase() : null;
422
+ if (lastWord && UNCOUNTABLE.has(lastWord)) {
423
+ return word;
424
+ }
425
+
426
+ // handle irregulars
427
+ const isCamelized = CAMELIZED_REGEX.test(word);
428
+ for (let [rule, substitution] of irregulars) {
429
+ if (lowercase.match(rule + '$')) {
430
+ if (isCamelized && lastWord && irregulars.has(lastWord)) {
431
+ substitution = capitalize(substitution);
432
+ rule = capitalize(rule);
433
+ }
434
+ return word.replace(new RegExp(rule, 'i'), substitution);
435
+ }
436
+ }
437
+
438
+ // do the actual inflection
439
+ for (const [rule, substitution] of typeRules) {
440
+ if (rule.test(word)) {
441
+ return word.replace(rule, substitution);
442
+ }
443
+ }
444
+ return word;
445
+ }
446
+
447
+ exports.camelize = camelize;
448
+ exports.capitalize = capitalize;
449
+ exports.clear = clear;
450
+ exports.clearRules = clearRules;
451
+ exports.dasherize = dasherize;
452
+ exports.irregular = irregular;
453
+ exports.loadIrregular = loadIrregular;
454
+ exports.loadUncountable = loadUncountable;
455
+ exports.plural = plural;
456
+ exports.pluralize = pluralize;
457
+ exports.resetToDefaults = resetToDefaults;
458
+ exports.setMaxLRUCacheSize = setMaxLRUCacheSize;
459
+ exports.singular = singular;
460
+ exports.singularize = singularize;
461
+ exports.uncountable = uncountable;
462
+ exports.underscore = underscore;
463
+ //# sourceMappingURL=string.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.cjs","sources":["../../../node_modules/.pnpm/@warp-d_713925c1c4fbcdf3390170e659dd4c3d/node_modules/@warp-drive/core/dist/utils/string.js","../src/-private/string/inflections.ts","../src/-private/string/transform.ts","../src/-private/string/inflect.ts"],"sourcesContent":["import { macroCondition, getGlobalConfig } from '@embroider/macros';\nconst DEFAULT_MAX_CACHE_SIZE = 10_000;\n\n/**\n * An LRUCache implementation with upsert semantics.\n *\n * This implementation is *not* generic, but focuses on\n * performance tuning for the string transformation cases\n * where the key maps to the value very simply.\n *\n * It takes a work function that should generate a new value\n * for a given key when called. It will be called when the key\n * is not found in the cache.\n *\n * It keeps track of the number of hits, misses, and ejections\n * in DEBUG envs, which is useful for tuning the cache size.\n *\n * This is an internal utility class for use by this module\n * and by `@warp-drive/utilities/string`. It is not intended\n * for use outside of these modules at this time.\n *\n * @internal\n */\nclass LRUCache {\n // debug stats\n\n constructor(doWork, size) {\n this.size = size || DEFAULT_MAX_CACHE_SIZE;\n this.state = new Map();\n this.doWork = doWork;\n if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {\n this._hits = 0;\n this._misses = 0;\n this._ejected = 0;\n }\n }\n get(key) {\n const value = this.state.get(key);\n if (value) {\n if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {\n this._hits++;\n }\n this.state.delete(key);\n this.state.set(key, value);\n return value;\n }\n if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {\n this._misses++;\n }\n const newValue = this.doWork(key);\n this.set(key, newValue);\n return newValue;\n }\n set(key, value) {\n if (this.state.size === this.size) {\n for (const [k] of this.state) {\n if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {\n this._ejected++;\n }\n this.state.delete(k);\n break;\n }\n }\n this.state.set(key, value);\n }\n clear() {\n this.state.clear();\n if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {\n this._hits = 0;\n this._misses = 0;\n this._ejected = 0;\n }\n }\n}\nconst STRING_DASHERIZE_REGEXP = /[ _]/g;\nconst STRING_DECAMELIZE_REGEXP = /([a-z\\d])([A-Z])/g;\nconst STRING_DASHERIZE_CACHE = new LRUCache(key => key.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase().replace(STRING_DASHERIZE_REGEXP, '-'));\n\n/**\n * This is an internal utility function that converts a string\n * to a dasherized format. Library consumers should use the\n * re-exported version from `@warp-drive/utilities/string` instead.\n *\n * This version is only in this location to support a deprecated\n * behavior in the core package and will be removed in a future.\n *\n * @internal\n */\nfunction dasherize(str) {\n return STRING_DASHERIZE_CACHE.get(str);\n}\nexport { LRUCache, STRING_DASHERIZE_CACHE, dasherize };","export type RulesArray = Array<[RegExp, string]>;\ntype DefaultRulesType = {\n plurals: RulesArray;\n singular: RulesArray;\n irregularPairs: Array<[string, string]>;\n uncountable: string[];\n};\n\nexport const defaultRules: DefaultRulesType = {\n plurals: [\n [/$/, 's'],\n [/s$/i, 's'],\n [/^(ax|test)is$/i, '$1es'],\n [/(octop|vir)us$/i, '$1i'],\n [/(octop|vir)i$/i, '$1i'],\n [/(alias|status|bonus)$/i, '$1es'],\n [/(bu)s$/i, '$1ses'],\n [/(buffal|tomat)o$/i, '$1oes'],\n [/([ti])um$/i, '$1a'],\n [/([ti])a$/i, '$1a'],\n [/sis$/i, 'ses'],\n [/(?:([^f])fe|([lr])f)$/i, '$1$2ves'],\n [/(hive)$/i, '$1s'],\n [/([^aeiouy]|qu)y$/i, '$1ies'],\n [/(x|ch|ss|sh)$/i, '$1es'],\n [/(matr|vert|ind)(?:ix|ex)$/i, '$1ices'],\n [/^(m|l)ouse$/i, '$1ice'],\n [/^(m|l)ice$/i, '$1ice'],\n [/^(ox)$/i, '$1en'],\n [/^(oxen)$/i, '$1'],\n [/(quiz)$/i, '$1zes'],\n ],\n\n singular: [\n [/s$/i, ''],\n [/(ss)$/i, '$1'],\n [/(n)ews$/i, '$1ews'],\n [/([ti])a$/i, '$1um'],\n [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '$1sis'],\n [/(^analy)(sis|ses)$/i, '$1sis'],\n [/([^f])ves$/i, '$1fe'],\n [/(hive)s$/i, '$1'],\n [/(tive)s$/i, '$1'],\n [/([lr])ves$/i, '$1f'],\n [/([^aeiouy]|qu)ies$/i, '$1y'],\n [/(s)eries$/i, '$1eries'],\n [/(m)ovies$/i, '$1ovie'],\n [/(x|ch|ss|sh)es$/i, '$1'],\n [/^(m|l)ice$/i, '$1ouse'],\n [/(bus)(es)?$/i, '$1'],\n [/(o)es$/i, '$1'],\n [/(shoe)s$/i, '$1'],\n [/(cris|test)(is|es)$/i, '$1is'],\n [/^(a)x[ie]s$/i, '$1xis'],\n [/(octop|vir)(us|i)$/i, '$1us'],\n [/(alias|status|bonus)(es)?$/i, '$1'],\n [/^(ox)en/i, '$1'],\n [/(vert|ind)ices$/i, '$1ex'],\n [/(matr)ices$/i, '$1ix'],\n [/(quiz)zes$/i, '$1'],\n [/(database)s$/i, '$1'],\n ],\n\n irregularPairs: [\n ['person', 'people'],\n ['man', 'men'],\n ['child', 'children'],\n ['sex', 'sexes'],\n ['move', 'moves'],\n ['cow', 'kine'],\n ['zombie', 'zombies'],\n ],\n\n uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police'],\n};\n","import { dasherize as internalDasherize, LRUCache, STRING_DASHERIZE_CACHE } from '@warp-drive/core/utils/string';\n\n// eslint-disable-next-line no-useless-escape\nconst STRING_CAMELIZE_REGEXP_1 = /(\\-|\\_|\\.|\\s)+(.)?/g;\nconst STRING_CAMELIZE_REGEXP_2 = /(^|\\/)([A-Z])/g;\nconst CAMELIZE_CACHE = new LRUCache<string, string>((key: string) =>\n key\n .replace(STRING_CAMELIZE_REGEXP_1, (_match, _separator, chr: string | null) => (chr ? chr.toUpperCase() : ''))\n .replace(STRING_CAMELIZE_REGEXP_2, (match /*, separator, chr */) => match.toLowerCase())\n);\n\nconst STRING_UNDERSCORE_REGEXP_1 = /([a-z\\d])([A-Z]+)/g;\n// eslint-disable-next-line no-useless-escape\nconst STRING_UNDERSCORE_REGEXP_2 = /\\-|\\s+/g;\nconst UNDERSCORE_CACHE = new LRUCache<string, string>((str: string) =>\n str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase()\n);\n\nconst STRING_CAPITALIZE_REGEXP = /(^|\\/)([a-z\\u00C0-\\u024F])/g;\nconst CAPITALIZE_CACHE = new LRUCache<string, string>((str: string) =>\n str.replace(STRING_CAPITALIZE_REGEXP, (match /*, separator, chr */) => match.toUpperCase())\n);\n\n/**\n * Replaces underscores, spaces, or camelCase with dashes.\n *\n * ```js\n * import { dasherize } from '@warp-drive/utilities/string';\n *\n * dasherize('innerHTML'); // 'inner-html'\n * dasherize('action_name'); // 'action-name'\n * dasherize('css-class-name'); // 'css-class-name'\n * dasherize('my favorite items'); // 'my-favorite-items'\n * dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport const dasherize = internalDasherize;\n\n/**\n * Returns the lowerCamelCase form of a string.\n *\n * ```js\n * import { camelize } from '@warp-drive/utilities/string';\n *\n * camelize('innerHTML'); // 'innerHTML'\n * camelize('action_name'); // 'actionName'\n * camelize('css-class-name'); // 'cssClassName'\n * camelize('my favorite items'); // 'myFavoriteItems'\n * camelize('My Favorite Items'); // 'myFavoriteItems'\n * camelize('private-docs/owner-invoice'); // 'privateDocs/ownerInvoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport function camelize(str: string): string {\n return CAMELIZE_CACHE.get(str);\n}\n\n/**\n * Returns the lower\\_case\\_and\\_underscored form of a string.\n *\n * ```js\n * import { underscore } from '@warp-drive/utilities/string';\n *\n * underscore('innerHTML'); // 'inner_html'\n * underscore('action_name'); // 'action_name'\n * underscore('css-class-name'); // 'css_class_name'\n * underscore('my favorite items'); // 'my_favorite_items'\n * underscore('privateDocs/ownerInvoice'); // 'private_docs/owner_invoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport function underscore(str: string): string {\n return UNDERSCORE_CACHE.get(str);\n}\n\n/**\n * Returns the Capitalized form of a string\n *\n * ```js\n * import { capitalize } from '@warp-drive/utilities/string';\n *\n * capitalize('innerHTML') // 'InnerHTML'\n * capitalize('action_name') // 'Action_name'\n * capitalize('css-class-name') // 'Css-class-name'\n * capitalize('my favorite items') // 'My favorite items'\n * capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'\n * ```\n *\n * @public\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport function capitalize(str: string): string {\n return CAPITALIZE_CACHE.get(str);\n}\n\n/**\n * Sets the maximum size of the LRUCache for all string transformation functions.\n * The default size is 10,000.\n *\n * @public\n * @param {Number} size\n * @return {void}\n * @since 4.13.0\n */\nexport function setMaxLRUCacheSize(size: number) {\n CAMELIZE_CACHE.size = size;\n UNDERSCORE_CACHE.size = size;\n CAPITALIZE_CACHE.size = size;\n STRING_DASHERIZE_CACHE.size = size;\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\nimport { LRUCache } from '@warp-drive/core/utils/string';\n\nimport { defaultRules } from './inflections.ts';\nimport { capitalize } from './transform.ts';\n\nconst BLANK_REGEX = /^\\s*$/;\nconst LAST_WORD_DASHED_REGEX = /([\\w/-]+[_/\\s-])([a-z\\d]+$)/;\nconst LAST_WORD_CAMELIZED_REGEX = /([\\w/\\s-]+)([A-Z][a-z\\d]*$)/;\nconst CAMELIZED_REGEX = /[A-Z][a-z\\d]*$/;\n\nconst SINGULARS = new LRUCache<string, string>((word: string) => {\n return _singularize(word);\n});\nconst PLURALS = new LRUCache<string, string>((word: string) => {\n return _pluralize(word);\n});\nconst UNCOUNTABLE = new Set(defaultRules.uncountable);\nconst IRREGULAR: Map<string, string> = new Map();\nconst INVERSE_IRREGULAR: Map<string, string> = new Map();\nconst SINGULAR_RULES = new Map(defaultRules.singular.reverse());\nconst PLURAL_RULES = new Map(defaultRules.plurals.reverse());\n\n/**\n * Marks a word as uncountable. Uncountable words are not pluralized\n * or singularized.\n *\n * @public\n * @param {String} word\n * @return {void}\n * @since 4.13.0\n */\nexport function uncountable(word: string) {\n UNCOUNTABLE.add(word.toLowerCase());\n}\n\n/**\n * Marks a list of words as uncountable. Uncountable words are not pluralized\n * or singularized.\n *\n * @public\n * @param {Array<String>} uncountables\n * @return {void}\n * @since 4.13.0\n */\nexport function loadUncountable(uncountables: string[]) {\n uncountables.forEach((word) => {\n uncountable(word);\n });\n}\n\n/**\n * Marks a word as irregular. Irregular words have unique\n * pluralization and singularization rules.\n *\n * @public\n * @param {String} single\n * @param {String} plur\n * @return {void}\n * @since 4.13.0\n */\nexport function irregular(single: string, plur: string) {\n //pluralizing\n IRREGULAR.set(single.toLowerCase(), plur);\n IRREGULAR.set(plur.toLowerCase(), plur);\n\n //singularizing\n INVERSE_IRREGULAR.set(plur.toLowerCase(), single);\n INVERSE_IRREGULAR.set(single.toLowerCase(), single);\n}\n\n/**\n * Marks a list of word pairs as irregular. Irregular words have unique\n * pluralization and singularization rules.\n *\n * @public\n * @param {Array<Array<String>>} irregularPairs\n * @return {void}\n * @since 4.13.0\n */\nexport function loadIrregular(irregularPairs: Array<[string, string]>) {\n irregularPairs.forEach((pair) => {\n //pluralizing\n IRREGULAR.set(pair[0].toLowerCase(), pair[1]);\n IRREGULAR.set(pair[1].toLowerCase(), pair[1]);\n\n //singularizing\n INVERSE_IRREGULAR.set(pair[1].toLowerCase(), pair[0]);\n INVERSE_IRREGULAR.set(pair[0].toLowerCase(), pair[0]);\n });\n}\nloadIrregular(defaultRules.irregularPairs);\n\n/**\n * Clears the caches for singularize and pluralize.\n *\n * @public\n * @return {void}\n * @since 4.13.0\n */\nexport function clear() {\n SINGULARS.clear();\n PLURALS.clear();\n}\n\n/**\n * Resets the inflection rules to the defaults.\n *\n * @public\n * @return {void}\n * @since 4.13.0\n */\nexport function resetToDefaults() {\n clearRules();\n defaultRules.uncountable.forEach((v) => UNCOUNTABLE.add(v));\n defaultRules.singular.forEach((v) => SINGULAR_RULES.set(v[0], v[1]));\n defaultRules.plurals.forEach((v) => PLURAL_RULES.set(v[0], v[1]));\n loadIrregular(defaultRules.irregularPairs);\n}\n\n/**\n * Clears all inflection rules\n * and resets the caches for singularize and pluralize.\n *\n * @public\n * @return {void}\n * @since 4.13.0\n */\nexport function clearRules() {\n SINGULARS.clear();\n PLURALS.clear();\n UNCOUNTABLE.clear();\n IRREGULAR.clear();\n INVERSE_IRREGULAR.clear();\n SINGULAR_RULES.clear();\n PLURAL_RULES.clear();\n}\n\n/**\n * Singularizes a word.\n *\n * @public\n * @param {String} word\n * @return {String}\n * @since 4.13.0\n */\nexport function singularize(word: string) {\n assert(`singularize expects to receive a non-empty string`, typeof word === 'string' && word.length > 0);\n if (!word) return '';\n return SINGULARS.get(word);\n}\n\n/**\n * Pluralizes a word.\n *\n * @public\n * @param {String} word\n * @return {String}\n * @since 4.13.0\n */\nexport function pluralize(word: string) {\n assert(`pluralize expects to receive a non-empty string`, typeof word === 'string' && word.length > 0);\n if (!word) return '';\n return PLURALS.get(word);\n}\n\nfunction unshiftMap<K, V>(v: [K, V], map: Map<K, V>) {\n // reorder\n const rules = [v, ...map.entries()];\n map.clear();\n rules.forEach((rule) => {\n map.set(rule[0], rule[1]);\n });\n}\n\n/**\n * Adds a pluralization rule.\n *\n * @public\n * @param {RegExp} regex\n * @param {String} string\n * @return {void}\n * @since 4.13.0\n */\nexport function plural(regex: RegExp, string: string) {\n // rule requires reordering if exists, so remove it first\n if (PLURAL_RULES.has(regex)) {\n PLURAL_RULES.delete(regex);\n }\n\n // reorder\n unshiftMap([regex, string], PLURAL_RULES);\n}\n\n/**\n * Adds a singularization rule.\n *\n * @public\n * @param {RegExp} regex\n * @param {String} string\n * @return {void}\n * @since 4.13.0\n */\nexport function singular(regex: RegExp, string: string) {\n // rule requires reordering if exists, so remove it first\n if (SINGULAR_RULES.has(regex)) {\n SINGULAR_RULES.delete(regex);\n }\n\n // reorder\n unshiftMap([regex, string], SINGULAR_RULES);\n}\n\nfunction _pluralize(word: string) {\n return inflect(word, PLURAL_RULES, IRREGULAR);\n}\n\nfunction _singularize(word: string) {\n return inflect(word, SINGULAR_RULES, INVERSE_IRREGULAR);\n}\n\nfunction inflect(word: string, typeRules: Map<RegExp, string>, irregulars: Map<string, string>) {\n // empty strings\n const isBlank = !word || BLANK_REGEX.test(word);\n if (isBlank) {\n return word;\n }\n\n // basic uncountables\n const lowercase = word.toLowerCase();\n if (UNCOUNTABLE.has(lowercase)) {\n return word;\n }\n\n // adv uncountables\n const wordSplit = LAST_WORD_DASHED_REGEX.exec(word) || LAST_WORD_CAMELIZED_REGEX.exec(word);\n const lastWord = wordSplit ? wordSplit[2].toLowerCase() : null;\n if (lastWord && UNCOUNTABLE.has(lastWord)) {\n return word;\n }\n\n // handle irregulars\n const isCamelized = CAMELIZED_REGEX.test(word);\n for (let [rule, substitution] of irregulars) {\n if (lowercase.match(rule + '$')) {\n if (isCamelized && lastWord && irregulars.has(lastWord)) {\n substitution = capitalize(substitution);\n rule = capitalize(rule);\n }\n\n return word.replace(new RegExp(rule, 'i'), substitution);\n }\n }\n\n // do the actual inflection\n for (const [rule, substitution] of typeRules) {\n if (rule.test(word)) {\n return word.replace(rule, substitution);\n }\n }\n\n return word;\n}\n"],"names":["DEFAULT_MAX_CACHE_SIZE","LRUCache","constructor","doWork","size","state","Map","get","key","value","delete","set","newValue","k","clear","STRING_DASHERIZE_REGEXP","STRING_DECAMELIZE_REGEXP","STRING_DASHERIZE_CACHE","replace","toLowerCase","dasherize","str","defaultRules","plurals","singular","irregularPairs","uncountable","STRING_CAMELIZE_REGEXP_1","STRING_CAMELIZE_REGEXP_2","CAMELIZE_CACHE","_match","_separator","chr","toUpperCase","match","STRING_UNDERSCORE_REGEXP_1","STRING_UNDERSCORE_REGEXP_2","UNDERSCORE_CACHE","STRING_CAPITALIZE_REGEXP","CAPITALIZE_CACHE","internalDasherize","camelize","underscore","capitalize","setMaxLRUCacheSize","BLANK_REGEX","LAST_WORD_DASHED_REGEX","LAST_WORD_CAMELIZED_REGEX","CAMELIZED_REGEX","SINGULARS","word","_singularize","PLURALS","_pluralize","UNCOUNTABLE","Set","IRREGULAR","INVERSE_IRREGULAR","SINGULAR_RULES","reverse","PLURAL_RULES","add","loadUncountable","uncountables","forEach","irregular","single","plur","loadIrregular","pair","resetToDefaults","clearRules","v","singularize","pluralize","unshiftMap","map","rules","entries","rule","plural","regex","string","has","inflect","typeRules","irregulars","isBlank","test","lowercase","wordSplit","exec","lastWord","isCamelized","substitution","RegExp"],"mappings":";;;;AACA,MAAMA,sBAAsB,GAAG,MAAM;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,CAAC;AACb;;AAEAC,EAAAA,WAAWA,CAACC,MAAM,EAAEC,IAAI,EAAE;AACxB,IAAA,IAAI,CAACA,IAAI,GAAGA,IAAI,IAAIJ,sBAAsB;AAC1C,IAAA,IAAI,CAACK,KAAK,GAAG,IAAIC,GAAG,EAAE;IACtB,IAAI,CAACH,MAAM,GA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,WAAW,GAAG7C,eAAe,CAACwC,IAAI,CAACtC,IAAI,CAAC;EAC9C,KAAK,IAAI,CAAC6B,IAAI,EAAEe,YAAY,CAAC,IAAIR,UAAU,EAAE;IAC3C,IAAIG,SAAS,CAACvD,KAAK,CAAC6C,IAAI,GAAG,GAAG,CAAC,EAAE;MAC/B,IAAIc,WAAW,IAAID,QAAQ,IAAIN,UAAU,CAACH,GAAG,CAACS,QAAQ,CAAC,EAAE;AACvDE,QAAAA,YAAY,GAAGnD,UAAU,CAACmD,YAAY,CAAC;AACvCf,QAAAA,IAAI,GAAGpC,UAAU,CAACoC,IAAI,CAAC;AACzB;AAEA,MAAA,OAAO7B,IAAI,CAAChC,OAAO,CAAC,IAAI6E,MAAM,CAAChB,IAAI,EAAE,GAAG,CAAC,EAAEe,YAAY,CAAC;AAC1D;AACF;;AAEA;EACA,KAAK,MAAM,CAACf,IAAI,EAAEe,YAAY,CAAC,IAAIT,SAAS,EAAE;AAC5C,IAAA,IAAIN,IAAI,CAACS,IAAI,CAACtC,IAAI,CAAC,EAAE;AACnB,MAAA,OAAOA,IAAI,CAAChC,OAAO,CAAC6D,IAAI,EAAEe,YAAY,CAAC;AACzC;AACF;AAEA,EAAA,OAAO5C,IAAI;AACb;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
package/dist/string.js CHANGED
@@ -1 +1 @@
1
- export { g as camelize, h as capitalize, d as clear, e as clearRules, f as dasherize, i as irregular, l as loadIrregular, c as loadUncountable, b as plural, p as pluralize, r as resetToDefaults, k as setMaxLRUCacheSize, a as singular, s as singularize, u as uncountable, j as underscore } from "./inflect-C1laviCe.js";
1
+ export { g as camelize, h as capitalize, d as clear, e as clearRules, f as dasherize, i as irregular, l as loadIrregular, c as loadUncountable, b as plural, p as pluralize, r as resetToDefaults, k as setMaxLRUCacheSize, a as singular, s as singularize, u as uncountable, j as underscore } from "./inflect-Dr20y6b1.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warp-drive/utilities",
3
- "version": "5.6.0-alpha.11",
3
+ "version": "5.6.0-alpha.13",
4
4
  "description": "Utilities package for WarpDrive | Things your app might find useful",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -26,13 +26,17 @@
26
26
  "types": "./declarations/index.d.ts",
27
27
  "default": "./dist/index.js"
28
28
  },
29
+ "./*.cjs": {
30
+ "types": "./declarations/*.d.ts",
31
+ "default": "./dist/*.cjs"
32
+ },
29
33
  "./*": {
30
34
  "types": "./declarations/*.d.ts",
31
35
  "default": "./dist/*.js"
32
36
  }
33
37
  },
34
38
  "peerDependencies": {
35
- "@warp-drive/core": "5.6.0-alpha.11"
39
+ "@warp-drive/core": "5.6.0-alpha.13"
36
40
  },
37
41
  "dependencies": {
38
42
  "@embroider/macros": "^1.16.12"
@@ -41,8 +45,8 @@
41
45
  "@babel/core": "^7.26.10",
42
46
  "@babel/plugin-transform-typescript": "^7.27.0",
43
47
  "@babel/preset-typescript": "^7.27.0",
44
- "@warp-drive/internal-config": "5.6.0-alpha.11",
45
- "@warp-drive/core": "5.6.0-alpha.11",
48
+ "@warp-drive/internal-config": "5.6.0-alpha.13",
49
+ "@warp-drive/core": "5.6.0-alpha.13",
46
50
  "decorator-transforms": "^2.3.0",
47
51
  "expect-type": "^1.2.1",
48
52
  "typescript": "^5.8.3",
@@ -60,7 +64,7 @@
60
64
  "edition": "octane"
61
65
  },
62
66
  "scripts": {
63
- "build:pkg": "vite build;",
67
+ "build:pkg": "vite build; vite build -c ./vite.config-cjs.mjs;",
64
68
  "lint": "eslint . --quiet --cache --cache-strategy=content",
65
69
  "sync": "echo \"syncing\"",
66
70
  "start": "vite"