@warp-drive/utilities 5.6.0-alpha.11

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSE.md +23 -0
  3. package/README.md +54 -0
  4. package/addon-main.cjs +5 -0
  5. package/declarations/-private/active-record/find-record.d.ts +66 -0
  6. package/declarations/-private/active-record/find-record.d.ts.map +1 -0
  7. package/declarations/-private/active-record/query.d.ts +54 -0
  8. package/declarations/-private/active-record/query.d.ts.map +1 -0
  9. package/declarations/-private/active-record/save-record.d.ts +144 -0
  10. package/declarations/-private/active-record/save-record.d.ts.map +1 -0
  11. package/declarations/-private/builder-utils.d.ts +5 -0
  12. package/declarations/-private/builder-utils.d.ts.map +1 -0
  13. package/declarations/-private/handlers/auto-compress.d.ts +153 -0
  14. package/declarations/-private/handlers/auto-compress.d.ts.map +1 -0
  15. package/declarations/-private/json-api/-utils.d.ts +110 -0
  16. package/declarations/-private/json-api/-utils.d.ts.map +1 -0
  17. package/declarations/-private/json-api/find-record.d.ts +66 -0
  18. package/declarations/-private/json-api/find-record.d.ts.map +1 -0
  19. package/declarations/-private/json-api/find-record.type-test.d.ts +2 -0
  20. package/declarations/-private/json-api/find-record.type-test.d.ts.map +1 -0
  21. package/declarations/-private/json-api/query.d.ts +104 -0
  22. package/declarations/-private/json-api/query.d.ts.map +1 -0
  23. package/declarations/-private/json-api/query.type-test.d.ts +2 -0
  24. package/declarations/-private/json-api/query.type-test.d.ts.map +1 -0
  25. package/declarations/-private/json-api/save-record.d.ts +191 -0
  26. package/declarations/-private/json-api/save-record.d.ts.map +1 -0
  27. package/declarations/-private/json-api/serialize.d.ts +57 -0
  28. package/declarations/-private/json-api/serialize.d.ts.map +1 -0
  29. package/declarations/-private/rest/find-record.d.ts +66 -0
  30. package/declarations/-private/rest/find-record.d.ts.map +1 -0
  31. package/declarations/-private/rest/query.d.ts +54 -0
  32. package/declarations/-private/rest/query.d.ts.map +1 -0
  33. package/declarations/-private/rest/save-record.d.ts +144 -0
  34. package/declarations/-private/rest/save-record.d.ts.map +1 -0
  35. package/declarations/-private/string/inflect.d.ts +105 -0
  36. package/declarations/-private/string/inflect.d.ts.map +1 -0
  37. package/declarations/-private/string/inflections.d.ts +10 -0
  38. package/declarations/-private/string/inflections.d.ts.map +1 -0
  39. package/declarations/-private/string/transform.d.ts +89 -0
  40. package/declarations/-private/string/transform.d.ts.map +1 -0
  41. package/declarations/-private.d.ts +2 -0
  42. package/declarations/-private.d.ts.map +1 -0
  43. package/declarations/active-record.d.ts +71 -0
  44. package/declarations/active-record.d.ts.map +1 -0
  45. package/declarations/handlers.d.ts +8 -0
  46. package/declarations/handlers.d.ts.map +1 -0
  47. package/declarations/index.d.ts +255 -0
  48. package/declarations/index.d.ts.map +1 -0
  49. package/declarations/json-api.d.ts +51 -0
  50. package/declarations/json-api.d.ts.map +1 -0
  51. package/declarations/rest.d.ts +51 -0
  52. package/declarations/rest.d.ts.map +1 -0
  53. package/declarations/string.d.ts +14 -0
  54. package/declarations/string.d.ts.map +1 -0
  55. package/dist/-private.js +7 -0
  56. package/dist/-private.js.map +1 -0
  57. package/dist/active-record.js +393 -0
  58. package/dist/active-record.js.map +1 -0
  59. package/dist/builder-utils-Donkk-BZ.js +22 -0
  60. package/dist/builder-utils-Donkk-BZ.js.map +1 -0
  61. package/dist/handlers.js +141 -0
  62. package/dist/handlers.js.map +1 -0
  63. package/dist/index.js +403 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/inflect-C1laviCe.js +376 -0
  66. package/dist/inflect-C1laviCe.js.map +1 -0
  67. package/dist/json-api.js +671 -0
  68. package/dist/json-api.js.map +1 -0
  69. package/dist/rest.js +393 -0
  70. package/dist/rest.js.map +1 -0
  71. package/dist/string.js +1 -0
  72. package/dist/string.js.map +1 -0
  73. package/logos/NCC-1701-a-blue.svg +4 -0
  74. package/logos/NCC-1701-a-gold.svg +4 -0
  75. package/logos/NCC-1701-a-gold_100.svg +1 -0
  76. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  77. package/logos/NCC-1701-a.svg +4 -0
  78. package/logos/README.md +4 -0
  79. package/logos/docs-badge.svg +2 -0
  80. package/logos/ember-data-logo-dark.svg +12 -0
  81. package/logos/ember-data-logo-light.svg +12 -0
  82. package/logos/github-header.svg +444 -0
  83. package/logos/social1.png +0 -0
  84. package/logos/social2.png +0 -0
  85. package/logos/warp-drive-logo-dark.svg +4 -0
  86. package/logos/warp-drive-logo-gold.svg +4 -0
  87. package/package.json +68 -0
@@ -0,0 +1,376 @@
1
+ import { LRUCache, dasherize as dasherize$1, STRING_DASHERIZE_CACHE } from '@warp-drive/core/utils/string';
2
+ import { InflectionRuleDefaults as defaultRules } from "./-private.js";
3
+ import { macroCondition, getGlobalConfig } from '@embroider/macros';
4
+
5
+ // eslint-disable-next-line no-useless-escape
6
+ const STRING_CAMELIZE_REGEXP_1 = /(\-|\_|\.|\s)+(.)?/g;
7
+ const STRING_CAMELIZE_REGEXP_2 = /(^|\/)([A-Z])/g;
8
+ 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()));
9
+ const STRING_UNDERSCORE_REGEXP_1 = /([a-z\d])([A-Z]+)/g;
10
+ // eslint-disable-next-line no-useless-escape
11
+ const STRING_UNDERSCORE_REGEXP_2 = /\-|\s+/g;
12
+ const UNDERSCORE_CACHE = new LRUCache(str => str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase());
13
+ const STRING_CAPITALIZE_REGEXP = /(^|\/)([a-z\u00C0-\u024F])/g;
14
+ const CAPITALIZE_CACHE = new LRUCache(str => str.replace(STRING_CAPITALIZE_REGEXP, (match /*, separator, chr */) => match.toUpperCase()));
15
+
16
+ /**
17
+ * Replaces underscores, spaces, or camelCase with dashes.
18
+ *
19
+ * ```js
20
+ * import { dasherize } from '@warp-drive/utilities/string';
21
+ *
22
+ * dasherize('innerHTML'); // 'inner-html'
23
+ * dasherize('action_name'); // 'action-name'
24
+ * dasherize('css-class-name'); // 'css-class-name'
25
+ * dasherize('my favorite items'); // 'my-favorite-items'
26
+ * dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'
27
+ * ```
28
+ *
29
+ * @public
30
+ * @param {String} str
31
+ * @return {String}
32
+ * @since 4.13.0
33
+ */
34
+ const dasherize = dasherize$1;
35
+
36
+ /**
37
+ * Returns the lowerCamelCase form of a string.
38
+ *
39
+ * ```js
40
+ * import { camelize } from '@warp-drive/utilities/string';
41
+ *
42
+ * camelize('innerHTML'); // 'innerHTML'
43
+ * camelize('action_name'); // 'actionName'
44
+ * camelize('css-class-name'); // 'cssClassName'
45
+ * camelize('my favorite items'); // 'myFavoriteItems'
46
+ * camelize('My Favorite Items'); // 'myFavoriteItems'
47
+ * camelize('private-docs/owner-invoice'); // 'privateDocs/ownerInvoice'
48
+ * ```
49
+ *
50
+ * @public
51
+ * @param {String} str
52
+ * @return {String}
53
+ * @since 4.13.0
54
+ */
55
+ function camelize(str) {
56
+ return CAMELIZE_CACHE.get(str);
57
+ }
58
+
59
+ /**
60
+ * Returns the lower\_case\_and\_underscored form of a string.
61
+ *
62
+ * ```js
63
+ * import { underscore } from '@warp-drive/utilities/string';
64
+ *
65
+ * underscore('innerHTML'); // 'inner_html'
66
+ * underscore('action_name'); // 'action_name'
67
+ * underscore('css-class-name'); // 'css_class_name'
68
+ * underscore('my favorite items'); // 'my_favorite_items'
69
+ * underscore('privateDocs/ownerInvoice'); // 'private_docs/owner_invoice'
70
+ * ```
71
+ *
72
+ * @public
73
+ * @param {String} str
74
+ * @return {String}
75
+ * @since 4.13.0
76
+ */
77
+ function underscore(str) {
78
+ return UNDERSCORE_CACHE.get(str);
79
+ }
80
+
81
+ /**
82
+ * Returns the Capitalized form of a string
83
+ *
84
+ * ```js
85
+ * import { capitalize } from '@warp-drive/utilities/string';
86
+ *
87
+ * capitalize('innerHTML') // 'InnerHTML'
88
+ * capitalize('action_name') // 'Action_name'
89
+ * capitalize('css-class-name') // 'Css-class-name'
90
+ * capitalize('my favorite items') // 'My favorite items'
91
+ * capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'
92
+ * ```
93
+ *
94
+ * @public
95
+ * @param {String} str
96
+ * @return {String}
97
+ * @since 4.13.0
98
+ */
99
+ function capitalize(str) {
100
+ return CAPITALIZE_CACHE.get(str);
101
+ }
102
+
103
+ /**
104
+ * Sets the maximum size of the LRUCache for all string transformation functions.
105
+ * The default size is 10,000.
106
+ *
107
+ * @public
108
+ * @param {Number} size
109
+ * @return {void}
110
+ * @since 4.13.0
111
+ */
112
+ function setMaxLRUCacheSize(size) {
113
+ CAMELIZE_CACHE.size = size;
114
+ UNDERSCORE_CACHE.size = size;
115
+ CAPITALIZE_CACHE.size = size;
116
+ STRING_DASHERIZE_CACHE.size = size;
117
+ }
118
+ const BLANK_REGEX = /^\s*$/;
119
+ const LAST_WORD_DASHED_REGEX = /([\w/-]+[_/\s-])([a-z\d]+$)/;
120
+ const LAST_WORD_CAMELIZED_REGEX = /([\w/\s-]+)([A-Z][a-z\d]*$)/;
121
+ const CAMELIZED_REGEX = /[A-Z][a-z\d]*$/;
122
+ const SINGULARS = new LRUCache(word => {
123
+ return _singularize(word);
124
+ });
125
+ const PLURALS = new LRUCache(word => {
126
+ return _pluralize(word);
127
+ });
128
+ const UNCOUNTABLE = new Set(defaultRules.uncountable);
129
+ const IRREGULAR = new Map();
130
+ const INVERSE_IRREGULAR = new Map();
131
+ const SINGULAR_RULES = new Map(defaultRules.singular.reverse());
132
+ const PLURAL_RULES = new Map(defaultRules.plurals.reverse());
133
+
134
+ /**
135
+ * Marks a word as uncountable. Uncountable words are not pluralized
136
+ * or singularized.
137
+ *
138
+ * @public
139
+ * @param {String} word
140
+ * @return {void}
141
+ * @since 4.13.0
142
+ */
143
+ function uncountable(word) {
144
+ UNCOUNTABLE.add(word.toLowerCase());
145
+ }
146
+
147
+ /**
148
+ * Marks a list of words as uncountable. Uncountable words are not pluralized
149
+ * or singularized.
150
+ *
151
+ * @public
152
+ * @param {Array<String>} uncountables
153
+ * @return {void}
154
+ * @since 4.13.0
155
+ */
156
+ function loadUncountable(uncountables) {
157
+ uncountables.forEach(word => {
158
+ uncountable(word);
159
+ });
160
+ }
161
+
162
+ /**
163
+ * Marks a word as irregular. Irregular words have unique
164
+ * pluralization and singularization rules.
165
+ *
166
+ * @public
167
+ * @param {String} single
168
+ * @param {String} plur
169
+ * @return {void}
170
+ * @since 4.13.0
171
+ */
172
+ function irregular(single, plur) {
173
+ //pluralizing
174
+ IRREGULAR.set(single.toLowerCase(), plur);
175
+ IRREGULAR.set(plur.toLowerCase(), plur);
176
+
177
+ //singularizing
178
+ INVERSE_IRREGULAR.set(plur.toLowerCase(), single);
179
+ INVERSE_IRREGULAR.set(single.toLowerCase(), single);
180
+ }
181
+
182
+ /**
183
+ * Marks a list of word pairs as irregular. Irregular words have unique
184
+ * pluralization and singularization rules.
185
+ *
186
+ * @public
187
+ * @param {Array<Array<String>>} irregularPairs
188
+ * @return {void}
189
+ * @since 4.13.0
190
+ */
191
+ function loadIrregular(irregularPairs) {
192
+ irregularPairs.forEach(pair => {
193
+ //pluralizing
194
+ IRREGULAR.set(pair[0].toLowerCase(), pair[1]);
195
+ IRREGULAR.set(pair[1].toLowerCase(), pair[1]);
196
+
197
+ //singularizing
198
+ INVERSE_IRREGULAR.set(pair[1].toLowerCase(), pair[0]);
199
+ INVERSE_IRREGULAR.set(pair[0].toLowerCase(), pair[0]);
200
+ });
201
+ }
202
+ loadIrregular(defaultRules.irregularPairs);
203
+
204
+ /**
205
+ * Clears the caches for singularize and pluralize.
206
+ *
207
+ * @public
208
+ * @return {void}
209
+ * @since 4.13.0
210
+ */
211
+ function clear() {
212
+ SINGULARS.clear();
213
+ PLURALS.clear();
214
+ }
215
+
216
+ /**
217
+ * Resets the inflection rules to the defaults.
218
+ *
219
+ * @public
220
+ * @return {void}
221
+ * @since 4.13.0
222
+ */
223
+ function resetToDefaults() {
224
+ clearRules();
225
+ defaultRules.uncountable.forEach(v => UNCOUNTABLE.add(v));
226
+ defaultRules.singular.forEach(v => SINGULAR_RULES.set(v[0], v[1]));
227
+ defaultRules.plurals.forEach(v => PLURAL_RULES.set(v[0], v[1]));
228
+ loadIrregular(defaultRules.irregularPairs);
229
+ }
230
+
231
+ /**
232
+ * Clears all inflection rules
233
+ * and resets the caches for singularize and pluralize.
234
+ *
235
+ * @public
236
+ * @return {void}
237
+ * @since 4.13.0
238
+ */
239
+ function clearRules() {
240
+ SINGULARS.clear();
241
+ PLURALS.clear();
242
+ UNCOUNTABLE.clear();
243
+ IRREGULAR.clear();
244
+ INVERSE_IRREGULAR.clear();
245
+ SINGULAR_RULES.clear();
246
+ PLURAL_RULES.clear();
247
+ }
248
+
249
+ /**
250
+ * Singularizes a word.
251
+ *
252
+ * @public
253
+ * @param {String} word
254
+ * @return {String}
255
+ * @since 4.13.0
256
+ */
257
+ function singularize(word) {
258
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
259
+ if (!test) {
260
+ throw new Error(`singularize expects to receive a non-empty string`);
261
+ }
262
+ })(typeof word === 'string' && word.length > 0) : {};
263
+ if (!word) return '';
264
+ return SINGULARS.get(word);
265
+ }
266
+
267
+ /**
268
+ * Pluralizes a word.
269
+ *
270
+ * @public
271
+ * @param {String} word
272
+ * @return {String}
273
+ * @since 4.13.0
274
+ */
275
+ function pluralize(word) {
276
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
277
+ if (!test) {
278
+ throw new Error(`pluralize expects to receive a non-empty string`);
279
+ }
280
+ })(typeof word === 'string' && word.length > 0) : {};
281
+ if (!word) return '';
282
+ return PLURALS.get(word);
283
+ }
284
+ function unshiftMap(v, map) {
285
+ // reorder
286
+ const rules = [v, ...map.entries()];
287
+ map.clear();
288
+ rules.forEach(rule => {
289
+ map.set(rule[0], rule[1]);
290
+ });
291
+ }
292
+
293
+ /**
294
+ * Adds a pluralization rule.
295
+ *
296
+ * @public
297
+ * @param {RegExp} regex
298
+ * @param {String} string
299
+ * @return {void}
300
+ * @since 4.13.0
301
+ */
302
+ function plural(regex, string) {
303
+ // rule requires reordering if exists, so remove it first
304
+ if (PLURAL_RULES.has(regex)) {
305
+ PLURAL_RULES.delete(regex);
306
+ }
307
+
308
+ // reorder
309
+ unshiftMap([regex, string], PLURAL_RULES);
310
+ }
311
+
312
+ /**
313
+ * Adds a singularization rule.
314
+ *
315
+ * @public
316
+ * @param {RegExp} regex
317
+ * @param {String} string
318
+ * @return {void}
319
+ * @since 4.13.0
320
+ */
321
+ function singular(regex, string) {
322
+ // rule requires reordering if exists, so remove it first
323
+ if (SINGULAR_RULES.has(regex)) {
324
+ SINGULAR_RULES.delete(regex);
325
+ }
326
+
327
+ // reorder
328
+ unshiftMap([regex, string], SINGULAR_RULES);
329
+ }
330
+ function _pluralize(word) {
331
+ return inflect(word, PLURAL_RULES, IRREGULAR);
332
+ }
333
+ function _singularize(word) {
334
+ return inflect(word, SINGULAR_RULES, INVERSE_IRREGULAR);
335
+ }
336
+ function inflect(word, typeRules, irregulars) {
337
+ // empty strings
338
+ const isBlank = !word || BLANK_REGEX.test(word);
339
+ if (isBlank) {
340
+ return word;
341
+ }
342
+
343
+ // basic uncountables
344
+ const lowercase = word.toLowerCase();
345
+ if (UNCOUNTABLE.has(lowercase)) {
346
+ return word;
347
+ }
348
+
349
+ // adv uncountables
350
+ const wordSplit = LAST_WORD_DASHED_REGEX.exec(word) || LAST_WORD_CAMELIZED_REGEX.exec(word);
351
+ const lastWord = wordSplit ? wordSplit[2].toLowerCase() : null;
352
+ if (lastWord && UNCOUNTABLE.has(lastWord)) {
353
+ return word;
354
+ }
355
+
356
+ // handle irregulars
357
+ const isCamelized = CAMELIZED_REGEX.test(word);
358
+ for (let [rule, substitution] of irregulars) {
359
+ if (lowercase.match(rule + '$')) {
360
+ if (isCamelized && lastWord && irregulars.has(lastWord)) {
361
+ substitution = capitalize(substitution);
362
+ rule = capitalize(rule);
363
+ }
364
+ return word.replace(new RegExp(rule, 'i'), substitution);
365
+ }
366
+ }
367
+
368
+ // do the actual inflection
369
+ for (const [rule, substitution] of typeRules) {
370
+ if (rule.test(word)) {
371
+ return word.replace(rule, substitution);
372
+ }
373
+ }
374
+ return word;
375
+ }
376
+ export { singular as a, plural as b, loadUncountable as c, clear as d, clearRules as e, dasherize as f, camelize as g, capitalize as h, irregular as i, underscore as j, setMaxLRUCacheSize as k, loadIrregular as l, pluralize as p, resetToDefaults as r, singularize as s, uncountable as u };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inflect-C1laviCe.js","sources":["../src/-private/string/transform.ts","../src/-private/string/inflect.ts"],"sourcesContent":["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":["STRING_CAMELIZE_REGEXP_1","STRING_CAMELIZE_REGEXP_2","CAMELIZE_CACHE","LRUCache","key","replace","_match","_separator","chr","toUpperCase","match","toLowerCase","STRING_UNDERSCORE_REGEXP_1","STRING_UNDERSCORE_REGEXP_2","UNDERSCORE_CACHE","str","STRING_CAPITALIZE_REGEXP","CAPITALIZE_CACHE","dasherize","internalDasherize","camelize","get","underscore","capitalize","setMaxLRUCacheSize","size","STRING_DASHERIZE_CACHE","BLANK_REGEX","LAST_WORD_DASHED_REGEX","LAST_WORD_CAMELIZED_REGEX","CAMELIZED_REGEX","SINGULARS","word","_singularize","PLURALS","_pluralize","UNCOUNTABLE","Set","defaultRules","uncountable","IRREGULAR","Map","INVERSE_IRREGULAR","SINGULAR_RULES","singular","reverse","PLURAL_RULES","plurals","add","loadUncountable","uncountables","forEach","irregular","single","plur","set","loadIrregular","irregularPairs","pair","clear","resetToDefaults","clearRules","v","singularize","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","length","pluralize","unshiftMap","map","rules","entries","rule","plural","regex","string","has","delete","inflect","typeRules","irregulars","isBlank","lowercase","wordSplit","exec","lastWord","isCamelized","substitution","RegExp"],"mappings":";;;;AAEA;AACA,MAAMA,wBAAwB,GAAG,qBAAqB;AACtD,MAAMC,wBAAwB,GAAG,gBAAgB;AACjD,MAAMC,cAAc,GAAG,IAAIC,QAAQ,CAAkBC,GAAW,IAC9DA,GAAG,CACAC,OAAO,CAACL,wBAAwB,EAAE,CAACM,MAAM,EAAEC,UAAU,EAAEC,GAAkB,KAAMA,GAAG,GAAGA,GAAG,CAACC,WAAW,EAAE,GAAG,EAAG,CAAC,CAC7GJ,OAAO,CAACJ,wBAAwB,EAAE,CAACS,KAAK,2BAA2BA,KAAK,CAACC,WAAW,EAAE,CAC3F,CAAC;AAED,MAAMC,0BAA0B,GAAG,oBAAoB;AACvD;AACA,MAAMC,0BAA0B,GAAG,SAAS;AAC5C,MAAMC,gBAAgB,GAAG,IAAIX,QAAQ,CAAkBY,GAAW,IAChEA,GAAG,CAACV,OAAO,CAACO,0BAA0B,EAAE,OAAO,CAAC,CAACP,OAAO,CAACQ,0BAA0B,EAAE,GAAG,CAAC,CAACF,WAAW,EACvG,CAAC;AAED,MAAMK,wBAAwB,GAAG,6BAA6B;AAC9D,MAAMC,gBAAgB,GAAG,IAAId,QAAQ,CAAkBY,GAAW,IAChEA,GAAG,CAACV,OAAO,CAACW,wBAAwB,EAAE,CAACN,KAAK,2BAA2BA,KAAK,CAACD,WAAW,EAAE,CAC5F,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMS,SAAS,GAAGC;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAACL,G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