@ember-data/request-utils 5.6.0-beta.0 → 5.6.0-beta.2

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 (30) hide show
  1. package/addon-main.cjs +1 -1
  2. package/dist/deprecation-support.js +9 -8
  3. package/dist/handlers.js +1 -147
  4. package/dist/index.js +7 -936
  5. package/dist/string.js +1 -2
  6. package/package.json +5 -17
  7. package/unstable-preview-types/deprecation-support.d.ts +2 -2
  8. package/unstable-preview-types/handlers.d.ts +8 -9
  9. package/unstable-preview-types/index.d.ts +10 -685
  10. package/unstable-preview-types/string.d.ts +13 -15
  11. package/dist/deprecation-support.js.map +0 -1
  12. package/dist/handlers.js.map +0 -1
  13. package/dist/index.js.map +0 -1
  14. package/dist/inflect-CwI_k2it.js +0 -305
  15. package/dist/inflect-CwI_k2it.js.map +0 -1
  16. package/dist/string.js.map +0 -1
  17. package/dist/transform-1PDozfHr.js +0 -192
  18. package/dist/transform-1PDozfHr.js.map +0 -1
  19. package/unstable-preview-types/-private/handlers/auto-compress.d.ts +0 -168
  20. package/unstable-preview-types/-private/handlers/auto-compress.d.ts.map +0 -1
  21. package/unstable-preview-types/-private/string/inflect.d.ts +0 -140
  22. package/unstable-preview-types/-private/string/inflect.d.ts.map +0 -1
  23. package/unstable-preview-types/-private/string/inflections.d.ts +0 -12
  24. package/unstable-preview-types/-private/string/inflections.d.ts.map +0 -1
  25. package/unstable-preview-types/-private/string/transform.d.ts +0 -117
  26. package/unstable-preview-types/-private/string/transform.d.ts.map +0 -1
  27. package/unstable-preview-types/deprecation-support.d.ts.map +0 -1
  28. package/unstable-preview-types/handlers.d.ts.map +0 -1
  29. package/unstable-preview-types/index.d.ts.map +0 -1
  30. package/unstable-preview-types/string.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"inflect-CwI_k2it.js","sources":["../src/-private/string/inflections.ts","../src/-private/string/inflect.ts"],"sourcesContent":["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","/**\n * @module @ember-data/request-utils/string\n */\nimport { assert } from '@warp-drive/build-config/macros';\n\nimport { defaultRules } from './inflections';\nimport { capitalize, LRUCache } from './transform';\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 * @method uncountable\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 * @method loadUncountable\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 * @method irregular\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 * @method loadIrregular\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 * @method clear\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 * @method resetToDefaults\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 * @method clearRules\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 * @method singularize\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 * @method pluralize\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 * @method plural\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 * @method singular\n * @public\n * @static\n * @for @ember-data/request-utils/string\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":["defaultRules","plurals","singular","irregularPairs","uncountable","BLANK_REGEX","LAST_WORD_DASHED_REGEX","LAST_WORD_CAMELIZED_REGEX","CAMELIZED_REGEX","SINGULARS","LRUCache","word","_singularize","PLURALS","_pluralize","UNCOUNTABLE","Set","IRREGULAR","Map","INVERSE_IRREGULAR","SINGULAR_RULES","reverse","PLURAL_RULES","add","toLowerCase","loadUncountable","uncountables","forEach","irregular","single","plur","set","loadIrregular","pair","clear","resetToDefaults","clearRules","v","singularize","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","length","get","pluralize","unshiftMap","map","rules","entries","rule","plural","regex","string","has","delete","inflect","typeRules","irregulars","isBlank","lowercase","wordSplit","exec","lastWord","isCamelized","substitution","match","capitalize","replace","RegExp"],"mappings":";;;AAQO,MAAMA,YAA8B,GAAG;AAC5CC,EAAAA,OAAO,EAAE,CACP,CAAC,GAAG,EAAE,GAAG,CAAC,EACV,CAAC,KAAK,EAAE,GAAG,CAAC,EACZ,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAC1B,CAAC,iBAAiB,EAAE,KAAK,CAAC,EAC1B,CAAC,gBAAgB,EAAE,KAAK,CAAC,EACzB,CAAC,wBAAwB,EAAE,MAAM,CAAC,EAClC,CAAC,SAAS,EAAE,OAAO,CAAC,EACpB,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAC9B,CAAC,YAAY,EAAE,KAAK,CAAC,EACrB,CAAC,WAAW,EAAE,KAAK,CAAC,EACpB,CAAC,OAAO,EAAE,KAAK,CAAC,EAChB,CAAC,wBAAwB,EAAE,SAAS,CAAC,EACrC,CAAC,UAAU,EAAE,KAAK,CAAC,EACnB,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAC9B,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAC1B,CAAC,4BAA4B,EAAE,QAAQ,CAAC,EACxC,CAAC,cAAc,EAAE,OAAO,CAAC,EACzB,CAAC,aAAa,EAAE,OAAO,CAAC,EACxB,CAAC,SAAS,EAAE,MAAM,CAAC,EACnB,CAAC,WAAW,EAAE,IAAI,CAAC,EACnB,CAAC,UAAU,EAAE,OAAO,CAAC,CACtB;AAEDC,EAAAA,QAAQ,EAAE,CACR,CAAC,KAAK,EAAE,EAAE,CAAC,EACX,CAAC,QAAQ,EAAE,IAAI,CAAC,EAChB,CAAC,UAAU,EAAE,OAAO,CAAC,EACrB,CAAC,WAAW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AC3F,EAAA,MAAMuD,QAAQ,GAAGF,SAAS,GAAGA,SAAS,CAAC,CAAC,CAAC,CAACxC,WAAW,EAAE,GAAG,IAAI;EAC9D,IAAI0C,QAAQ,IAAInD,WAAW,CAAC0C,GAAG,CAACS,QAAQ,CAAC,EAAE;AACzC,IAAA,OAAOvD,IAAI;AACb;;AAEA;AACA,EAAA,MAAMwD,WAAW,GAAG3D,eAAe,CAACoC,IAAI,CAACjC,IAAI,CAAC;EAC9C,KAAK,IAAI,CAAC0C,IAAI,EAAEe,YAAY,CAAC,IAAIP,UAAU,EAAE;IAC3C,IAAIE,SAAS,CAACM,KAAK,CAAChB,IAAI,GAAG,GAAG,CAAC,EAAE;MAC/B,IAAIc,WAAW,IAAID,QAAQ,IAAIL,UAAU,CAACJ,GAAG,CAACS,QAAQ,CAAC,EAAE;AACvDE,QAAAA,YAAY,GAAGE,UAAU,CAACF,YAAY,CAAC;AACvCf,QAAAA,IAAI,GAAGiB,UAAU,CAACjB,IAAI,CAAC;AACzB;AAEA,MAAA,OAAO1C,IAAI,CAAC4D,OAAO,CAAC,IAAIC,MAAM,CAACnB,IAAI,EAAE,GAAG,CAAC,EAAEe,YAAY,CAAC;AAC1D;AACF;;AAEA;EACA,KAAK,MAAM,CAACf,IAAI,EAAEe,YAAY,CAAC,IAAIR,SAAS,EAAE;AAC5C,IAAA,IAAIP,IAAI,CAACT,IAAI,CAACjC,IAAI,CAAC,EAAE;AACnB,MAAA,OAAOA,IAAI,CAAC4D,OAAO,CAAClB,IAAI,EAAEe,YAAY,CAAC;AACzC;AACF;AAEA,EAAA,OAAOzD,IAAI;AACb;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,192 +0,0 @@
1
- import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
-
3
- /**
4
- * @module @ember-data/request-utils/string
5
- */
6
- const DEFAULT_MAX_CACHE_SIZE = 10_000;
7
- class LRUCache {
8
- // debug stats
9
-
10
- constructor(doWork, size) {
11
- this.size = size || DEFAULT_MAX_CACHE_SIZE;
12
- this.state = new Map();
13
- this.doWork = doWork;
14
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
15
- this._hits = 0;
16
- this._misses = 0;
17
- this._ejected = 0;
18
- }
19
- }
20
- get(key) {
21
- const value = this.state.get(key);
22
- if (value) {
23
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
24
- this._hits++;
25
- }
26
- this.state.delete(key);
27
- this.state.set(key, value);
28
- return value;
29
- }
30
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
31
- this._misses++;
32
- }
33
- const newValue = this.doWork(key);
34
- this.set(key, newValue);
35
- return newValue;
36
- }
37
- set(key, value) {
38
- if (this.state.size === this.size) {
39
- for (const [k] of this.state) {
40
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
41
- this._ejected++;
42
- }
43
- this.state.delete(k);
44
- break;
45
- }
46
- }
47
- this.state.set(key, value);
48
- }
49
- clear() {
50
- this.state.clear();
51
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
52
- this._hits = 0;
53
- this._misses = 0;
54
- this._ejected = 0;
55
- }
56
- }
57
- }
58
- const STRING_DASHERIZE_REGEXP = /[ _]/g;
59
- const STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
60
- const STRING_DASHERIZE_CACHE = new LRUCache(key => key.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase().replace(STRING_DASHERIZE_REGEXP, '-'));
61
-
62
- // eslint-disable-next-line no-useless-escape
63
- const STRING_CAMELIZE_REGEXP_1 = /(\-|\_|\.|\s)+(.)?/g;
64
- const STRING_CAMELIZE_REGEXP_2 = /(^|\/)([A-Z])/g;
65
- 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()));
66
- const STRING_UNDERSCORE_REGEXP_1 = /([a-z\d])([A-Z]+)/g;
67
- // eslint-disable-next-line no-useless-escape
68
- const STRING_UNDERSCORE_REGEXP_2 = /\-|\s+/g;
69
- const UNDERSCORE_CACHE = new LRUCache(str => str.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2').replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase());
70
- const STRING_CAPITALIZE_REGEXP = /(^|\/)([a-z\u00C0-\u024F])/g;
71
- const CAPITALIZE_CACHE = new LRUCache(str => str.replace(STRING_CAPITALIZE_REGEXP, (match /*, separator, chr */) => match.toUpperCase()));
72
-
73
- /**
74
- * Replaces underscores, spaces, or camelCase with dashes.
75
- *
76
- * ```js
77
- * import { dasherize } from '@ember-data/request-utils/string';
78
- *
79
- * dasherize('innerHTML'); // 'inner-html'
80
- * dasherize('action_name'); // 'action-name'
81
- * dasherize('css-class-name'); // 'css-class-name'
82
- * dasherize('my favorite items'); // 'my-favorite-items'
83
- * dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'
84
- * ```
85
- *
86
- * @method dasherize
87
- * @public
88
- * @static
89
- * @for @ember-data/request-utils/string
90
- * @param {String} str
91
- * @return {String}
92
- * @since 4.13.0
93
- */
94
- function dasherize(str) {
95
- return STRING_DASHERIZE_CACHE.get(str);
96
- }
97
-
98
- /**
99
- * Returns the lowerCamelCase form of a string.
100
- *
101
- * ```js
102
- * import { camelize } from '@ember-data/request-utils/string';
103
- *
104
- * camelize('innerHTML'); // 'innerHTML'
105
- * camelize('action_name'); // 'actionName'
106
- * camelize('css-class-name'); // 'cssClassName'
107
- * camelize('my favorite items'); // 'myFavoriteItems'
108
- * camelize('My Favorite Items'); // 'myFavoriteItems'
109
- * camelize('private-docs/owner-invoice'); // 'privateDocs/ownerInvoice'
110
- * ```
111
- *
112
- * @method camelize
113
- * @public
114
- * @static
115
- * @for @ember-data/request-utils/string
116
- * @param {String} str
117
- * @return {String}
118
- * @since 4.13.0
119
- */
120
- function camelize(str) {
121
- return CAMELIZE_CACHE.get(str);
122
- }
123
-
124
- /**
125
- * Returns the lower\_case\_and\_underscored form of a string.
126
- *
127
- * ```js
128
- * import { underscore } from '@ember-data/request-utils/string';
129
- *
130
- * underscore('innerHTML'); // 'inner_html'
131
- * underscore('action_name'); // 'action_name'
132
- * underscore('css-class-name'); // 'css_class_name'
133
- * underscore('my favorite items'); // 'my_favorite_items'
134
- * underscore('privateDocs/ownerInvoice'); // 'private_docs/owner_invoice'
135
- * ```
136
- *
137
- * @method underscore
138
- * @public
139
- * @static
140
- * @for @ember-data/request-utils/string
141
- * @param {String} str
142
- * @return {String}
143
- * @since 4.13.0
144
- */
145
- function underscore(str) {
146
- return UNDERSCORE_CACHE.get(str);
147
- }
148
-
149
- /**
150
- * Returns the Capitalized form of a string
151
- *
152
- * ```js
153
- * import { capitalize } from '@ember-data/request-utils/string';
154
- *
155
- * capitalize('innerHTML') // 'InnerHTML'
156
- * capitalize('action_name') // 'Action_name'
157
- * capitalize('css-class-name') // 'Css-class-name'
158
- * capitalize('my favorite items') // 'My favorite items'
159
- * capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'
160
- * ```
161
- *
162
- * @method capitalize
163
- * @static
164
- * @public
165
- * @for @ember-data/request-utils/string
166
- * @param {String} str
167
- * @return {String}
168
- * @since 4.13.0
169
- */
170
- function capitalize(str) {
171
- return CAPITALIZE_CACHE.get(str);
172
- }
173
-
174
- /**
175
- * Sets the maximum size of the LRUCache for all string transformation functions.
176
- * The default size is 10,000.
177
- *
178
- * @method setMaxLRUCacheSize
179
- * @public
180
- * @static
181
- * @for @ember-data/request-utils/string
182
- * @param {Number} size
183
- * @return {void}
184
- * @since 4.13.0
185
- */
186
- function setMaxLRUCacheSize(size) {
187
- CAMELIZE_CACHE.size = size;
188
- UNDERSCORE_CACHE.size = size;
189
- CAPITALIZE_CACHE.size = size;
190
- STRING_DASHERIZE_CACHE.size = size;
191
- }
192
- export { LRUCache as L, capitalize as a, camelize as c, dasherize as d, setMaxLRUCacheSize as s, underscore as u };
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform-1PDozfHr.js","sources":["../src/-private/string/transform.ts"],"sourcesContent":["/**\n * @module @ember-data/request-utils/string\n */\nimport { DEBUG } from '@warp-drive/build-config/env';\n\nconst DEFAULT_MAX_CACHE_SIZE = 10_000;\nexport class LRUCache<T, V> {\n declare size: number;\n declare state: Map<T, V>;\n declare doWork: (k: T) => V;\n\n // debug stats\n declare _hits: number;\n declare _misses: number;\n declare _ejected: number;\n\n constructor(doWork: (k: T) => V, size?: number) {\n this.size = size || DEFAULT_MAX_CACHE_SIZE;\n this.state = new Map();\n this.doWork = doWork;\n\n if (DEBUG) {\n this._hits = 0;\n this._misses = 0;\n this._ejected = 0;\n }\n }\n get(key: T) {\n const value = this.state.get(key);\n if (value) {\n if (DEBUG) {\n this._hits++;\n }\n this.state.delete(key);\n this.state.set(key, value);\n return value;\n }\n if (DEBUG) {\n this._misses++;\n }\n\n const newValue = this.doWork(key);\n this.set(key, newValue);\n return newValue;\n }\n\n set(key: T, value: V) {\n if (this.state.size === this.size) {\n for (const [k] of this.state) {\n if (DEBUG) {\n this._ejected++;\n }\n this.state.delete(k);\n break;\n }\n }\n this.state.set(key, value);\n }\n\n clear() {\n this.state.clear();\n if (DEBUG) {\n this._hits = 0;\n this._misses = 0;\n this._ejected = 0;\n }\n }\n}\n\nconst STRING_DASHERIZE_REGEXP = /[ _]/g;\nconst STRING_DECAMELIZE_REGEXP = /([a-z\\d])([A-Z])/g;\nconst STRING_DASHERIZE_CACHE = new LRUCache<string, string>((key: string) =>\n key.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase().replace(STRING_DASHERIZE_REGEXP, '-')\n);\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 '@ember-data/request-utils/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 * @method dasherize\n * @public\n * @static\n * @for @ember-data/request-utils/string\n * @param {String} str\n * @return {String}\n * @since 4.13.0\n */\nexport function dasherize(str: string): string {\n return STRING_DASHERIZE_CACHE.get(str);\n}\n\n/**\n * Returns the lowerCamelCase form of a string.\n *\n * ```js\n * import { camelize } from '@ember-data/request-utils/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 * @method camelize\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 '@ember-data/request-utils/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 * @method underscore\n * @public\n * @static\n * @for @ember-data/request-utils/string\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 '@ember-data/request-utils/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 * @method capitalize\n * @static\n * @public\n * @for @ember-data/request-utils/string\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 * @method setMaxLRUCacheSize\n * @public\n * @static\n * @for @ember-data/request-utils/string\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"],"names":["DEFAULT_MAX_CACHE_SIZE","LRUCache","constructor","doWork","size","state","Map","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","_hits","_misses","_ejected","get","key","value","delete","set","newValue","k","clear","STRING_DASHERIZE_REGEXP","STRING_DECAMELIZE_REGEXP","STRING_DASHERIZE_CACHE","replace","toLowerCase","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","str","STRING_CAPITALIZE_REGEXP","CAPITALIZE_CACHE","dasherize","camelize","underscore","capitalize","setMaxLRUCacheSize"],"mappings":";;AAAA;AACA;AACA;AAGA,MAAMA,sBAAsB,GAAG,MAAM;AAC9B,MAAMC,QAAQ,CAAO;AAK1B;;AAKAC,EAAAA,WAAWA,CAACC,MAAmB,EAAEC,IAAa,EAAE;AAC9C,IAAA,IAAI,CAACA,IAAI,GAAGA,IAAI,IAAIJ,sBAAsB;AAC1C,IAAA,IAAI,CAACK,KAAK,GAAG,IAAIC,GAAG,EAAE;IACtB,IAAI,CAACH,MAAM,GAAGA,MAAM;IAEpB,IAAAI,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAW,EAAA;MACT,IAAI,CAACC,KAAK,GAAG,CAAC;MACd,IAAI,CAACC,OAAO,GAAG,CAAC;MAChB,IAAI,CAACC,QAAQ,GAAG,CAAC;AACnB;AACF;EACAC,GAAGA,CAACC,GAAM,EAAE;IACV,MAAMC,KAAK,GAAG,IAAI,CAACZ,KAAK,CAACU,GAAG,CAACC,GAAG,CAAC;AACjC,IAAA,IAAIC,KAAK,EAAE;MACT,IAAAV,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAW,EAAA;QACT,IAAI,CAACC,KAAK,EAAE;AACd;AACA,MAAA,IAAI,CAACP,KAAK,CAACa,MAAM,C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C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,QAAQA,CAACJ,GAAW,EAAU;AAC5C,EAAA,OAAOT,cAAc,CAACf,GAAG,CAACwB,GAAG,CAAC;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,UAAUA,CAACL,GAAW,EAAU;AAC9C,EAAA,OAAOD,gBAAgB,CAACvB,GAAG,CAACwB,GAAG,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,UAAUA,CAACN,GAAW,EAAU;AAC9C,EAAA,OAAOE,gBAAgB,CAAC1B,GAAG,CAACwB,GAAG,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,kBAAkBA,CAAC1C,IAAY,EAAE;EAC/C0B,cAAc,CAAC1B,IAAI,GAAGA,IAAI;EAC1BkC,gBAAgB,CAAClC,IAAI,GAAGA,IAAI;EAC5BqC,gBAAgB,CAACrC,IAAI,GAAGA,IAAI;EAC5BqB,sBAAsB,CAACrB,IAAI,GAAGA,IAAI;AACpC;;;;"}
@@ -1,168 +0,0 @@
1
- declare module '@ember-data/request-utils/-private/handlers/auto-compress' {
2
- /**
3
- * @module @ember-data/request-utils/handlers
4
- */
5
- import type { Future, Handler, NextFn, RequestContext } from '@ember-data/request';
6
- export const SupportsRequestStreams: boolean;
7
- interface Constraints {
8
- /**
9
- * The minimum size at which to compress blobs
10
- *
11
- * @default 1000
12
- * @typedoc
13
- */
14
- Blob?: number;
15
- /**
16
- * The minimum size at which to compress array buffers
17
- *
18
- * @default 1000
19
- * @typedoc
20
- */
21
- ArrayBuffer?: number;
22
- /**
23
- * The minimum size at which to compress typed arrays
24
- *
25
- * @default 1000
26
- * @typedoc
27
- */
28
- TypedArray?: number;
29
- /**
30
- * The minimum size at which to compress data views
31
- *
32
- * @default 1000
33
- * @typedoc
34
- */
35
- DataView?: number;
36
- /**
37
- * The minimum size at which to compress strings
38
- *
39
- * @default 1000
40
- * @typedoc
41
- */
42
- String?: number;
43
- }
44
- /**
45
- * Options for configuring the AutoCompress handler.
46
- *
47
- * @typedoc
48
- */
49
- interface CompressionOptions {
50
- /**
51
- * The compression format to use. Must be a valid
52
- * compression format supported by [CompressionStream](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)
53
- *
54
- * The default is `gzip`.
55
- *
56
- * @typedoc
57
- */
58
- format?: CompressionFormat;
59
- /**
60
- * Some browsers support `ReadableStream` as a request body. This option
61
- * enables passing the compression stream as the request body instead of
62
- * the final compressed body when the browser supports doing so.
63
- *
64
- * This comes with several caveats:
65
- *
66
- * - the request will be put into `duplex: 'half'` mode. This should be
67
- * transparent to you, but it is worth noting.
68
- * - the request mode cannot be `no-cors` as requests with a `ReadableStream`
69
- * have no content length and thus are a new form of request that triggers
70
- * cors requirements and a preflight request.
71
- * - http/1.x is not supported.
72
- *
73
- * For additional reading about the restrictions of using `ReadableStream`
74
- * as a request body, see the [Chromium Documentation](https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests#restrictions)
75
- *
76
- * Streaming can be enabled per-request in browsers which support it by
77
- * setting `request.options.allowStreaming` to `true`.
78
- *
79
- * Streaming can be forced even when the browser does not support it by setting
80
- * `request.options.forceStreaming` to `true`. This is useful if later handlers
81
- * in the chain can handle the request body as a stream.
82
- *
83
- * @default false
84
- * @typedoc
85
- */
86
- allowStreaming?: boolean;
87
- /**
88
- * If `true`, the request will be forced into streaming mode even
89
- * if the browser does not support it. This is useful if later handlers
90
- * in the chain can handle the request body as a stream.
91
- *
92
- * @default false
93
- * @typedoc
94
- */
95
- forceStreaming?: boolean;
96
- /**
97
- * The constraints for the request body. This is used to determine
98
- * whether to compress the request body or not.
99
- *
100
- * The defaults are:
101
- *
102
- * ```ts
103
- * {
104
- * Blob: 1000, // blob.size
105
- * ArrayBuffer: 1000, // buffer.byteLength
106
- * TypedArray: 1000, // array.byteLength
107
- * DataView: 1000, // view.byteLength
108
- * String: 1000, // string.length
109
- * }
110
- * ```
111
- *
112
- * The following body types are never compressed unless explicitly
113
- * configured by the request:
114
- * - `FormData`
115
- * - `URLSearchParams`
116
- * - `ReadableStream`
117
- *
118
- * A request.options.compress value of `false` will disable
119
- * compression for a request body of any type. While a value of
120
- * `true` will enable compression for the request.
121
- *
122
- * An undefined value will use the default, a value of `0` will
123
- * enable compression for all values, and a value of `-1` will
124
- * disable compression.
125
- *
126
- * @typedoc
127
- */
128
- constraints?: Constraints;
129
- }
130
- /**
131
- * A request handler that automatically compresses the request body
132
- * if the request body is a string, array buffer, blob, or form data.
133
- *
134
- * This uses the [CompressionStream API](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream)
135
- *
136
- * The compression format as well as the kinds of data to compress can be
137
- * configured using the `format` and `constraints` options.
138
- *
139
- * ```diff
140
- * +import { AutoCompress } from '@ember-data/request-utils/handlers';
141
- * import Fetch from '@ember-data/request/fetch';
142
- * import RequestManager from '@ember-data/request';
143
- * import Store from '@ember-data/store';
144
- *
145
- * class AppStore extends Store {
146
- * requestManager = new RequestManager()
147
- * .use([
148
- * + new AutoCompress(),
149
- * Fetch
150
- * ]);
151
- * }
152
- * ```
153
- *
154
- * @class AutoCompress
155
- * @extends Handler
156
- * @public
157
- * @since 5.5.0
158
- */
159
- export class AutoCompress implements Handler {
160
- options: Required<CompressionOptions> & {
161
- constraints: Required<Constraints>;
162
- };
163
- constructor(options?: CompressionOptions);
164
- request<T>({ request }: RequestContext, next: NextFn<T>): Promise<T> | Future<T>;
165
- }
166
- export {};
167
- }
168
- //# sourceMappingURL=auto-compress.d.ts.map
@@ -1 +0,0 @@
1
- {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0 @@
1
- declare module '@ember-data/request-utils/-private/string/inflect' {
2
- /**
3
- * Marks a word as uncountable. Uncountable words are not pluralized
4
- * or singularized.
5
- *
6
- * @method uncountable
7
- * @public
8
- * @static
9
- * @for @ember-data/request-utils/string
10
- * @param {String} word
11
- * @return {void}
12
- * @since 4.13.0
13
- */
14
- export function uncountable(word: string): void;
15
- /**
16
- * Marks a list of words as uncountable. Uncountable words are not pluralized
17
- * or singularized.
18
- *
19
- * @method loadUncountable
20
- * @public
21
- * @static
22
- * @for @ember-data/request-utils/string
23
- * @param {Array<String>} uncountables
24
- * @return {void}
25
- * @since 4.13.0
26
- */
27
- export function loadUncountable(uncountables: string[]): void;
28
- /**
29
- * Marks a word as irregular. Irregular words have unique
30
- * pluralization and singularization rules.
31
- *
32
- * @method irregular
33
- * @public
34
- * @static
35
- * @for @ember-data/request-utils/string
36
- * @param {String} single
37
- * @param {String} plur
38
- * @return {void}
39
- * @since 4.13.0
40
- */
41
- export function irregular(single: string, plur: string): void;
42
- /**
43
- * Marks a list of word pairs as irregular. Irregular words have unique
44
- * pluralization and singularization rules.
45
- *
46
- * @method loadIrregular
47
- * @public
48
- * @static
49
- * @for @ember-data/request-utils/string
50
- * @param {Array<Array<String>>} irregularPairs
51
- * @return {void}
52
- * @since 4.13.0
53
- */
54
- export function loadIrregular(irregularPairs: Array<[string, string]>): void;
55
- /**
56
- * Clears the caches for singularize and pluralize.
57
- *
58
- * @method clear
59
- * @public
60
- * @static
61
- * @for @ember-data/request-utils/string
62
- * @return {void}
63
- * @since 4.13.0
64
- */
65
- export function clear(): void;
66
- /**
67
- * Resets the inflection rules to the defaults.
68
- *
69
- * @method resetToDefaults
70
- * @public
71
- * @static
72
- * @for @ember-data/request-utils/string
73
- * @return {void}
74
- * @since 4.13.0
75
- */
76
- export function resetToDefaults(): void;
77
- /**
78
- * Clears all inflection rules
79
- * and resets the caches for singularize and pluralize.
80
- *
81
- * @method clearRules
82
- * @public
83
- * @static
84
- * @for @ember-data/request-utils/string
85
- * @return {void}
86
- * @since 4.13.0
87
- */
88
- export function clearRules(): void;
89
- /**
90
- * Singularizes a word.
91
- *
92
- * @method singularize
93
- * @public
94
- * @static
95
- * @for @ember-data/request-utils/string
96
- * @param {String} word
97
- * @return {String}
98
- * @since 4.13.0
99
- */
100
- export function singularize(word: string): string;
101
- /**
102
- * Pluralizes a word.
103
- *
104
- * @method pluralize
105
- * @public
106
- * @static
107
- * @for @ember-data/request-utils/string
108
- * @param {String} word
109
- * @return {String}
110
- * @since 4.13.0
111
- */
112
- export function pluralize(word: string): string;
113
- /**
114
- * Adds a pluralization rule.
115
- *
116
- * @method plural
117
- * @public
118
- * @static
119
- * @for @ember-data/request-utils/string
120
- * @param {RegExp} regex
121
- * @param {String} string
122
- * @return {void}
123
- * @since 4.13.0
124
- */
125
- export function plural(regex: RegExp, string: string): void;
126
- /**
127
- * Adds a singularization rule.
128
- *
129
- * @method singular
130
- * @public
131
- * @static
132
- * @for @ember-data/request-utils/string
133
- * @param {RegExp} regex
134
- * @param {String} string
135
- * @return {void}
136
- * @since 4.13.0
137
- */
138
- export function singular(regex: RegExp, string: string): void;
139
- }
140
- //# sourceMappingURL=inflect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inflect.d.ts","sourceRoot":"","sources":["../../../src/-private/string/inflect.ts"],"names":[],"mappings":"AAyBA;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,QAEvC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,QAIrD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAQrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,QAUpE;AAGD;;;;;;;;;GASG;AACH,wBAAgB,KAAK,SAGpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,SAM9B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,SAQzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAIvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,UAIrC;AAWD;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAQnD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAQrD"}
@@ -1,12 +0,0 @@
1
- declare module '@ember-data/request-utils/-private/string/inflections' {
2
- export type RulesArray = Array<[RegExp, string]>;
3
- type DefaultRulesType = {
4
- plurals: RulesArray;
5
- singular: RulesArray;
6
- irregularPairs: Array<[string, string]>;
7
- uncountable: string[];
8
- };
9
- export const defaultRules: DefaultRulesType;
10
- export {};
11
- }
12
- //# sourceMappingURL=inflections.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inflections.d.ts","sourceRoot":"","sources":["../../../src/-private/string/inflections.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACjD,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,UAAU,CAAC;IACrB,cAAc,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,gBAkE1B,CAAC"}