@hichchi/utils 0.0.1-alpha.1 → 0.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/README.md +6236 -1032
- package/constants/constants.d.ts +223 -0
- package/constants/constants.js +227 -0
- package/constants/constants.js.map +1 -0
- package/constants/english-inflection-rules.d.ts +53 -0
- package/constants/english-inflection-rules.js +360 -0
- package/constants/english-inflection-rules.js.map +1 -0
- package/constants/index.d.ts +2 -0
- package/constants/index.js +6 -0
- package/constants/index.js.map +1 -0
- package/enums/index.d.ts +1 -0
- package/{src → enums}/index.js +1 -1
- package/enums/index.js.map +1 -0
- package/enums/template-tag.enum.d.ts +33 -0
- package/enums/template-tag.enum.js +39 -0
- package/enums/template-tag.enum.js.map +1 -0
- package/index.d.ts +5 -0
- package/index.js +9 -0
- package/index.js.map +1 -0
- package/interfaces/index.d.ts +3 -0
- package/interfaces/index.js +7 -0
- package/interfaces/index.js.map +1 -0
- package/interfaces/infinite-object.interface.d.ts +45 -0
- package/interfaces/infinite-object.interface.js +3 -0
- package/interfaces/infinite-object.interface.js.map +1 -0
- package/interfaces/inflection-rule.interfaces.d.ts +142 -0
- package/interfaces/inflection-rule.interfaces.js +3 -0
- package/interfaces/inflection-rule.interfaces.js.map +1 -0
- package/interfaces/path-value-set.interface.d.ts +79 -0
- package/interfaces/path-value-set.interface.js +3 -0
- package/interfaces/path-value-set.interface.js.map +1 -0
- package/package.json +4 -4
- package/readme-top.md +182 -6
- package/types/deep-partial.type.d.ts +47 -0
- package/types/deep-partial.type.js +3 -0
- package/types/deep-partial.type.js.map +1 -0
- package/types/index.d.ts +34 -0
- package/types/index.js +38 -0
- package/types/index.js.map +1 -0
- package/types/is-already-in-path.type.d.ts +24 -0
- package/types/is-already-in-path.type.js +3 -0
- package/types/is-already-in-path.type.js.map +1 -0
- package/types/is-empty.type.d.ts +25 -0
- package/types/is-empty.type.js +3 -0
- package/types/is-empty.type.js.map +1 -0
- package/types/is-primitive.type.d.ts +27 -0
- package/types/is-primitive.type.js +4 -0
- package/types/is-primitive.type.js.map +1 -0
- package/types/literal-object.type.d.ts +49 -0
- package/types/literal-object.type.js +3 -0
- package/types/literal-object.type.js.map +1 -0
- package/{src/lib/types.d.ts → types/loose-autocomplete.type.d.ts} +18 -6
- package/types/loose-autocomplete.type.js +3 -0
- package/types/loose-autocomplete.type.js.map +1 -0
- package/types/partial-with-null.type.d.ts +27 -0
- package/types/partial-with-null.type.js +3 -0
- package/types/partial-with-null.type.js.map +1 -0
- package/types/prettify.type.d.ts +23 -0
- package/types/prettify.type.js +3 -0
- package/types/prettify.type.js.map +1 -0
- package/types/type.type.d.ts +21 -0
- package/{src/lib/interfaces.js → types/type.type.js} +1 -1
- package/types/type.type.js.map +1 -0
- package/utils/assertions.utils.d.ts +150 -0
- package/utils/assertions.utils.js +163 -0
- package/utils/assertions.utils.js.map +1 -0
- package/utils/file.utils.d.ts +87 -0
- package/{src/lib → utils}/file.utils.js +78 -26
- package/utils/file.utils.js.map +1 -0
- package/{src/lib → utils}/index.d.ts +3 -5
- package/{src/lib → utils}/index.js +3 -5
- package/utils/index.js.map +1 -0
- package/utils/object.utils.d.ts +912 -0
- package/utils/object.utils.js +1069 -0
- package/utils/object.utils.js.map +1 -0
- package/utils/string-template.utils.d.ts +169 -0
- package/utils/string-template.utils.js +269 -0
- package/utils/string-template.utils.js.map +1 -0
- package/utils/string.utils.d.ts +932 -0
- package/utils/string.utils.js +1255 -0
- package/utils/string.utils.js.map +1 -0
- package/utils/url.utils.d.ts +99 -0
- package/utils/url.utils.js +112 -0
- package/utils/url.utils.js.map +1 -0
- package/src/index.d.ts +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/assertions.utils.d.ts +0 -55
- package/src/lib/assertions.utils.js +0 -68
- package/src/lib/assertions.utils.js.map +0 -1
- package/src/lib/file.utils.d.ts +0 -25
- package/src/lib/file.utils.js.map +0 -1
- package/src/lib/index.js.map +0 -1
- package/src/lib/interfaces.d.ts +0 -6
- package/src/lib/interfaces.js.map +0 -1
- package/src/lib/object.utils.d.ts +0 -265
- package/src/lib/object.utils.js +0 -414
- package/src/lib/object.utils.js.map +0 -1
- package/src/lib/string-template.utils.d.ts +0 -25
- package/src/lib/string-template.utils.js +0 -40
- package/src/lib/string-template.utils.js.map +0 -1
- package/src/lib/string.utils.d.ts +0 -217
- package/src/lib/string.utils.js +0 -314
- package/src/lib/string.utils.js.map +0 -1
- package/src/lib/types.js +0 -4
- package/src/lib/types.js.map +0 -1
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnglishInflectionRules = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
/**
|
|
6
|
+
* Comprehensive rules for English word inflection (singular/plural transformations)
|
|
7
|
+
*
|
|
8
|
+
* This module provides a structured collection of rules for transforming English words
|
|
9
|
+
* between singular and plural forms. The rules are organized into categories based on
|
|
10
|
+
* linguistic patterns and exceptions, ensuring accurate transformations for various
|
|
11
|
+
* word types.
|
|
12
|
+
*
|
|
13
|
+
* Key features:
|
|
14
|
+
* - Invariant words that are identical in singular and plural forms
|
|
15
|
+
* - Irregular plural forms that don't follow standard patterns
|
|
16
|
+
* - Latin and Greek origin words with their specific plural formations
|
|
17
|
+
* - Pattern-based rules for common English word endings
|
|
18
|
+
* - Default fallback rules for standard English pluralization
|
|
19
|
+
*
|
|
20
|
+
* The rules are applied in a specific priority order, from most specific to most general,
|
|
21
|
+
* to ensure correct handling of special cases. Each rule consists of a regular expression
|
|
22
|
+
* pattern and a replacement string or function.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Using the rules with the plural() function
|
|
27
|
+
* import { EnglishInflectionRules } from '@hichchi/utils/constants';
|
|
28
|
+
* import { InflectionRule } from '@hichchi/utils/interfaces';
|
|
29
|
+
*
|
|
30
|
+
* function plural(word: string): string {
|
|
31
|
+
* // Combine all rules in priority order
|
|
32
|
+
* const rules: InflectionRule[] = [
|
|
33
|
+
* ...EnglishInflectionRules.INVARIANT,
|
|
34
|
+
* ...EnglishInflectionRules.IRREGULAR.toPlural,
|
|
35
|
+
* ...EnglishInflectionRules.LATIN_GREEK.toPlural,
|
|
36
|
+
* ...EnglishInflectionRules.PATTERN_RULES.toPlural,
|
|
37
|
+
* ...EnglishInflectionRules.DEFAULT.toPlural,
|
|
38
|
+
* ];
|
|
39
|
+
*
|
|
40
|
+
* // Apply the first matching rule
|
|
41
|
+
* for (const rule of rules) {
|
|
42
|
+
* if (rule.regex.test(word)) {
|
|
43
|
+
* return word.replace(rule.regex, rule.replacement as string);
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* return word;
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @see {@link plural} Function that uses these rules to convert words to plural form
|
|
52
|
+
* @see {@link singular} Function that uses these rules to convert words to singular form
|
|
53
|
+
* @see {@link InflectionRuleCategories} Interface defining the structure of the rules
|
|
54
|
+
* @see {@link InflectionRule} Interface for individual transformation rules
|
|
55
|
+
*/
|
|
56
|
+
exports.EnglishInflectionRules = {
|
|
57
|
+
/**
|
|
58
|
+
* Words that are the same in singular and plural form
|
|
59
|
+
*
|
|
60
|
+
* This category contains rules for words that don't change between singular and plural forms.
|
|
61
|
+
* These invariant words (also called "zero plurals") have identical singular and plural forms
|
|
62
|
+
* in English. The rule simply returns the word unchanged.
|
|
63
|
+
*
|
|
64
|
+
* Common examples include:
|
|
65
|
+
* - Animal names: "fish", "deer", "sheep"
|
|
66
|
+
* - Scientific terms: "species", "series"
|
|
67
|
+
* - Uncountable nouns: "equipment"
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* // These words remain unchanged in plural form
|
|
72
|
+
* plural("fish"); // "fish"
|
|
73
|
+
* plural("deer"); // "deer"
|
|
74
|
+
* plural("sheep"); // "sheep"
|
|
75
|
+
* plural("species"); // "species"
|
|
76
|
+
* plural("equipment"); // "equipment"
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @see {@link plural} Function that applies these rules
|
|
80
|
+
* @see {@link singular} Function that applies these rules
|
|
81
|
+
*/
|
|
82
|
+
INVARIANT: [{ regex: /^(fish|deer|sheep|species|series|equipment)$/i, replacement: "$1" }],
|
|
83
|
+
/**
|
|
84
|
+
* Irregular plural forms
|
|
85
|
+
*
|
|
86
|
+
* This category contains rules for words with irregular plural forms that don't
|
|
87
|
+
* follow standard English pluralization patterns. These words have unique
|
|
88
|
+
* transformations between singular and plural forms that must be handled as
|
|
89
|
+
* special cases.
|
|
90
|
+
*
|
|
91
|
+
* The category is divided into two rule sets:
|
|
92
|
+
* - toPlural: Rules for converting singular forms to their irregular plural forms
|
|
93
|
+
* - toSingular: Rules for converting irregular plural forms back to singular
|
|
94
|
+
*
|
|
95
|
+
* These rules handle common irregular English plurals like "child/children",
|
|
96
|
+
* "man/men", "tooth/teeth", etc. Many of these irregular forms have historical
|
|
97
|
+
* origins in Old English and other Germanic languages.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* // Singular to plural transformations
|
|
102
|
+
* plural("child"); // "children"
|
|
103
|
+
* plural("man"); // "men"
|
|
104
|
+
* plural("tooth"); // "teeth"
|
|
105
|
+
* plural("person"); // "people"
|
|
106
|
+
*
|
|
107
|
+
* // Plural to singular transformations
|
|
108
|
+
* singular("children"); // "child"
|
|
109
|
+
* singular("men"); // "man"
|
|
110
|
+
* singular("teeth"); // "tooth"
|
|
111
|
+
* singular("people"); // "person"
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @see {@link plural} Function that applies these rules for pluralization
|
|
115
|
+
* @see {@link singular} Function that applies these rules for singularization
|
|
116
|
+
*/
|
|
117
|
+
IRREGULAR: {
|
|
118
|
+
// Singular to plural transformations
|
|
119
|
+
toPlural: [
|
|
120
|
+
{ regex: /^child$/i, replacement: "children" },
|
|
121
|
+
{ regex: /^man$/i, replacement: "men" },
|
|
122
|
+
{ regex: /^woman$/i, replacement: "women" },
|
|
123
|
+
{ regex: /^tooth$/i, replacement: "teeth" },
|
|
124
|
+
{ regex: /^foot$/i, replacement: "feet" },
|
|
125
|
+
{ regex: /^goose$/i, replacement: "geese" },
|
|
126
|
+
{ regex: /^mouse$/i, replacement: "mice" },
|
|
127
|
+
{ regex: /^person$/i, replacement: "people" },
|
|
128
|
+
{ regex: /^ox$/i, replacement: "oxen" },
|
|
129
|
+
],
|
|
130
|
+
// Plural to singular transformations
|
|
131
|
+
toSingular: [
|
|
132
|
+
{ regex: /children$/i, replacement: "child" },
|
|
133
|
+
{ regex: /men$/i, replacement: "man" },
|
|
134
|
+
{ regex: /women$/i, replacement: "woman" },
|
|
135
|
+
{ regex: /teeth$/i, replacement: "tooth" },
|
|
136
|
+
{ regex: /feet$/i, replacement: "foot" },
|
|
137
|
+
{ regex: /geese$/i, replacement: "goose" },
|
|
138
|
+
{ regex: /mice$/i, replacement: "mouse" },
|
|
139
|
+
{ regex: /people$/i, replacement: "person" },
|
|
140
|
+
{ regex: /oxen$/i, replacement: "ox" },
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
* Latin/Greek origin words
|
|
145
|
+
*
|
|
146
|
+
* This category contains rules for words borrowed from Latin and Greek that
|
|
147
|
+
* retain their original pluralization patterns. These words follow different
|
|
148
|
+
* rules than native English words and often have distinctive ending changes.
|
|
149
|
+
*
|
|
150
|
+
* The category is divided into two rule sets:
|
|
151
|
+
* - toPlural: Rules for converting Latin/Greek singular forms to their plural forms
|
|
152
|
+
* - toSingular: Rules for converting Latin/Greek plural forms back to singular
|
|
153
|
+
*
|
|
154
|
+
* Common patterns include:
|
|
155
|
+
* - "-us" → "-i" (cactus/cacti, fungus/fungi)
|
|
156
|
+
* - "-is" → "-es" (analysis/analyses, thesis/theses)
|
|
157
|
+
* - "-on"/"-um" → "-a" (criterion/criteria, datum/data)
|
|
158
|
+
* - "-ex"/"-ix" → "-ices" (index/indices, matrix/matrices)
|
|
159
|
+
*
|
|
160
|
+
* These words are often found in academic, scientific, and technical contexts.
|
|
161
|
+
* Note that some of these words have alternative anglicized plural forms that
|
|
162
|
+
* are also acceptable in modern English (e.g., "cactuses" alongside "cacti").
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* // Singular to plural transformations
|
|
167
|
+
* plural("cactus"); // "cacti"
|
|
168
|
+
* plural("analysis"); // "analyses"
|
|
169
|
+
* plural("criterion"); // "criteria"
|
|
170
|
+
* plural("index"); // "indices"
|
|
171
|
+
* plural("matrix"); // "matrices"
|
|
172
|
+
*
|
|
173
|
+
* // Plural to singular transformations
|
|
174
|
+
* singular("cacti"); // "cactus"
|
|
175
|
+
* singular("analyses"); // "analysis"
|
|
176
|
+
* singular("criteria"); // "criterion"
|
|
177
|
+
* singular("indices"); // "index"
|
|
178
|
+
* singular("matrices"); // "matrix"
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* @see {@link plural} Function that applies these rules for pluralization
|
|
182
|
+
* @see {@link singular} Function that applies these rules for singularization
|
|
183
|
+
*/
|
|
184
|
+
LATIN_GREEK: {
|
|
185
|
+
// Singular to plural transformations
|
|
186
|
+
toPlural: [
|
|
187
|
+
{ regex: /^cactus$/i, replacement: "cacti" },
|
|
188
|
+
{ regex: /^focus$/i, replacement: "foci" },
|
|
189
|
+
{ regex: /^fungus$/i, replacement: "fungi" },
|
|
190
|
+
{ regex: /^nucleus$/i, replacement: "nuclei" },
|
|
191
|
+
{ regex: /^syllabus$/i, replacement: "syllabi" },
|
|
192
|
+
{ regex: /^analysis$/i, replacement: "analyses" },
|
|
193
|
+
{ regex: /^diagnosis$/i, replacement: "diagnoses" },
|
|
194
|
+
{ regex: /^thesis$/i, replacement: "theses" },
|
|
195
|
+
{ regex: /^criterion$/i, replacement: "criteria" },
|
|
196
|
+
{ regex: /^datum$/i, replacement: "data" },
|
|
197
|
+
{ regex: /^phenomenon$/i, replacement: "phenomena" },
|
|
198
|
+
{ regex: /^index$/i, replacement: "indices" },
|
|
199
|
+
{ regex: /^matrix$/i, replacement: "matrices" },
|
|
200
|
+
{ regex: /^vertex$/i, replacement: "vertices" },
|
|
201
|
+
{ regex: /^appendix$/i, replacement: "appendices" },
|
|
202
|
+
],
|
|
203
|
+
// Plural to singular transformations
|
|
204
|
+
toSingular: [
|
|
205
|
+
{ regex: /matrices$/i, replacement: "matrix" },
|
|
206
|
+
{ regex: /indices$/i, replacement: "index" },
|
|
207
|
+
{ regex: /vertices$/i, replacement: "vertex" },
|
|
208
|
+
{ regex: /appendices$/i, replacement: "appendix" },
|
|
209
|
+
{ regex: /cacti$/i, replacement: "cactus" },
|
|
210
|
+
{ regex: /foci$/i, replacement: "focus" },
|
|
211
|
+
{ regex: /fungi$/i, replacement: "fungus" },
|
|
212
|
+
{ regex: /nuclei$/i, replacement: "nucleus" },
|
|
213
|
+
{ regex: /syllabi$/i, replacement: "syllabus" },
|
|
214
|
+
{ regex: /analyses$/i, replacement: "analysis" },
|
|
215
|
+
{ regex: /diagnoses$/i, replacement: "diagnosis" },
|
|
216
|
+
{ regex: /theses$/i, replacement: "thesis" },
|
|
217
|
+
{ regex: /criteria$/i, replacement: "criterion" },
|
|
218
|
+
{ regex: /data$/i, replacement: "datum" },
|
|
219
|
+
{ regex: /phenomena$/i, replacement: "phenomenon" },
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
/**
|
|
223
|
+
* Words with specific ending patterns
|
|
224
|
+
*
|
|
225
|
+
* This category contains rules for words that follow regular patterns based on
|
|
226
|
+
* their endings. These patterns represent the most common rules for English
|
|
227
|
+
* pluralization and singularization, covering a wide range of everyday words.
|
|
228
|
+
*
|
|
229
|
+
* The category is divided into two rule sets:
|
|
230
|
+
* - toPlural: Rules for converting singular forms to plural based on word endings
|
|
231
|
+
* - toSingular: Rules for converting plural forms back to singular
|
|
232
|
+
*
|
|
233
|
+
* Key pattern groups include:
|
|
234
|
+
*
|
|
235
|
+
* 1. Words ending in -f or -fe:
|
|
236
|
+
* - "knife" → "knives", "life" → "lives", "wolf" → "wolves"
|
|
237
|
+
*
|
|
238
|
+
* 2. Words ending in -y:
|
|
239
|
+
* - After consonant: "city" → "cities", "baby" → "babies"
|
|
240
|
+
* - After vowel: "boy" → "boys", "key" → "keys"
|
|
241
|
+
*
|
|
242
|
+
* 3. Words ending in -o:
|
|
243
|
+
* - Some specific words: "hero" → "heroes", "potato" → "potatoes"
|
|
244
|
+
* - After consonant: "echo" → "echoes", "tomato" → "tomatoes"
|
|
245
|
+
*
|
|
246
|
+
* 4. Words ending in -s, -ss, -sh, -ch, -x, -z:
|
|
247
|
+
* - "bus" → "buses", "box" → "boxes", "dish" → "dishes"
|
|
248
|
+
*
|
|
249
|
+
* These patterns cover the majority of regular English pluralization rules
|
|
250
|
+
* and are applied after checking for invariant words, irregular forms, and
|
|
251
|
+
* Latin/Greek words.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```typescript
|
|
255
|
+
* // Words ending in -f or -fe
|
|
256
|
+
* plural("knife"); // "knives"
|
|
257
|
+
* plural("life"); // "lives"
|
|
258
|
+
* plural("wolf"); // "wolves"
|
|
259
|
+
*
|
|
260
|
+
* // Words ending in -y
|
|
261
|
+
* plural("city"); // "cities"
|
|
262
|
+
* plural("boy"); // "boys"
|
|
263
|
+
*
|
|
264
|
+
* // Words ending in -o
|
|
265
|
+
* plural("hero"); // "heroes"
|
|
266
|
+
* plural("photo"); // "photos"
|
|
267
|
+
*
|
|
268
|
+
* // Words ending in -s, -ss, -sh, -ch, -x, -z
|
|
269
|
+
* plural("bus"); // "buses"
|
|
270
|
+
* plural("box"); // "boxes"
|
|
271
|
+
* plural("dish"); // "dishes"
|
|
272
|
+
*
|
|
273
|
+
* // Plural to singular
|
|
274
|
+
* singular("knives"); // "knife"
|
|
275
|
+
* singular("cities"); // "city"
|
|
276
|
+
* singular("boxes"); // "box"
|
|
277
|
+
* ```
|
|
278
|
+
*
|
|
279
|
+
* @see {@link plural} Function that applies these rules for pluralization
|
|
280
|
+
* @see {@link singular} Function that applies these rules for singularization
|
|
281
|
+
* @see {@link CHARACTERS_TO_REMOVE} Constant used in some replacement functions
|
|
282
|
+
*/
|
|
283
|
+
PATTERN_RULES: {
|
|
284
|
+
// Singular to plural transformations
|
|
285
|
+
toPlural: [
|
|
286
|
+
// Words ending in -f or -fe
|
|
287
|
+
{ regex: /^((?:wi|li)fe)$/i, replacement: "$1ves" },
|
|
288
|
+
{ regex: /(fe)$/i, replacement: "ves" },
|
|
289
|
+
{ regex: /([^f])f$/i, replacement: "$1ves" },
|
|
290
|
+
// Words ending in -y
|
|
291
|
+
{ regex: /([^aeiou])y$/i, replacement: "$1ies" },
|
|
292
|
+
{ regex: /([aeiou]y)$/i, replacement: "$1s" },
|
|
293
|
+
// Words ending in -o
|
|
294
|
+
{ regex: /(hero|potato|tomato|torpedo|veto)$/i, replacement: "$1es" },
|
|
295
|
+
{ regex: /([^aeiou])o$/i, replacement: "$1oes" },
|
|
296
|
+
// Words ending in -is
|
|
297
|
+
{ regex: /(is)$/i, replacement: "es" },
|
|
298
|
+
// Words ending in -us
|
|
299
|
+
{ regex: /(us)$/i, replacement: "uses" },
|
|
300
|
+
// Words ending in -s, -ss, -sh, -ch, -x, -z
|
|
301
|
+
{ regex: /(s|ss|sh|ch|x|z)$/i, replacement: "$1es" },
|
|
302
|
+
],
|
|
303
|
+
// Plural to singular transformations
|
|
304
|
+
toSingular: [
|
|
305
|
+
// Special spelling changes
|
|
306
|
+
{ regex: /knives$/i, replacement: "knife" },
|
|
307
|
+
{ regex: /lives$/i, replacement: "life" },
|
|
308
|
+
{ regex: /shelves$/i, replacement: "shelf" },
|
|
309
|
+
// Common word patterns
|
|
310
|
+
{
|
|
311
|
+
regex: /(buses|dishes|matches)$/i,
|
|
312
|
+
replacement: (match) => match.slice(0, -constants_1.CHARACTERS_TO_REMOVE),
|
|
313
|
+
},
|
|
314
|
+
{ regex: /([^aeiouy]|qu)ies$/i, replacement: "$1y" },
|
|
315
|
+
{ regex: /(x|ch|ss|sh)es$/i, replacement: "$1" },
|
|
316
|
+
{ regex: /oes$/i, replacement: "o" },
|
|
317
|
+
{ regex: /ves$/i, replacement: "f" },
|
|
318
|
+
],
|
|
319
|
+
},
|
|
320
|
+
/**
|
|
321
|
+
* Default rules for standard transformations
|
|
322
|
+
*
|
|
323
|
+
* This category contains fallback rules that are applied when no other rules match.
|
|
324
|
+
* These represent the most basic and common English pluralization pattern: adding
|
|
325
|
+
* an "s" to form plurals and removing an "s" to form singulars.
|
|
326
|
+
*
|
|
327
|
+
* The category is divided into two rule sets:
|
|
328
|
+
* - toPlural: Adds "s" to the end of any word to form its plural
|
|
329
|
+
* - toSingular: Removes a trailing "s" from any word to form its singular
|
|
330
|
+
*
|
|
331
|
+
* These rules are applied as a last resort after all other more specific rules
|
|
332
|
+
* have been checked. They handle the majority of regular English words that don't
|
|
333
|
+
* fall into any of the special categories or patterns.
|
|
334
|
+
*
|
|
335
|
+
* While simple, these rules can sometimes produce incorrect results for words that
|
|
336
|
+
* should follow more specific patterns but weren't included in the other rule sets.
|
|
337
|
+
* They're designed as a reasonable fallback rather than a comprehensive solution.
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* ```typescript
|
|
341
|
+
* // Singular to plural with default rule
|
|
342
|
+
* plural("book"); // "books"
|
|
343
|
+
* plural("car"); // "cars"
|
|
344
|
+
* plural("apple"); // "apples"
|
|
345
|
+
*
|
|
346
|
+
* // Plural to singular with default rule
|
|
347
|
+
* singular("books"); // "book"
|
|
348
|
+
* singular("cars"); // "car"
|
|
349
|
+
* singular("apples"); // "apple"
|
|
350
|
+
* ```
|
|
351
|
+
*
|
|
352
|
+
* @see {@link plural} Function that applies these rules for pluralization
|
|
353
|
+
* @see {@link singular} Function that applies these rules for singularization
|
|
354
|
+
*/
|
|
355
|
+
DEFAULT: {
|
|
356
|
+
toPlural: [{ regex: /(.*)$/i, replacement: "$1s" }],
|
|
357
|
+
toSingular: [{ regex: /s$/i, replacement: "" }],
|
|
358
|
+
},
|
|
359
|
+
};
|
|
360
|
+
//# sourceMappingURL=english-inflection-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"english-inflection-rules.js","sourceRoot":"","sources":["../../../../libs/utils/src/constants/english-inflection-rules.ts"],"names":[],"mappings":";;;AAAA,2CAAmD;AAGnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACU,QAAA,sBAAsB,GAA6B;IAC5D;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,+CAA+C,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAE1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,SAAS,EAAE;QACP,qCAAqC;QACrC,QAAQ,EAAE;YACN,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE;YAC9C,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE;YACvC,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE;YAC3C,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE;YAC3C,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE;YACzC,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE;YAC3C,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE;YAC1C,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE;YAC7C,EAAE,KAAK,EAAE,O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E;YAE5C,uBAAuB;YACvB;gBACI,KAAK,EAAE,0BAA0B;gBACjC,WAAW,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,gCAAoB,CAAC;aAChF;YACD,EAAE,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,KAAK,EAAE;YACpD,EAAE,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,IAAI,EAAE;YAChD,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE;YACpC,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE;SACvC;KACJ;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,OAAO,EAAE;QACL,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;QACnD,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;KAClD;CACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./constants"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./english-inflection-rules"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/utils/src/constants/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,qEAA2C"}
|
package/enums/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./template-tag.enum";
|
package/{src → enums}/index.js
RENAMED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/utils/src/enums/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template tags for string transformations
|
|
3
|
+
*
|
|
4
|
+
* This enum defines all available template tags that can be used with the `applyTemplate`
|
|
5
|
+
* and `applyTemplates` functions. Each tag corresponds to a specific string transformation
|
|
6
|
+
* function from the string.utils module.
|
|
7
|
+
*
|
|
8
|
+
* Template tags are represented as strings in the format `#{transformationName}`. When these
|
|
9
|
+
* tags appear in template strings, they are replaced with the result of applying the
|
|
10
|
+
* corresponding transformation to the provided value.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link applyTemplate} For applying a single value to a template
|
|
13
|
+
* @see {@link applyTemplates} For applying multiple values to a template
|
|
14
|
+
*/
|
|
15
|
+
export declare enum TemplateTag {
|
|
16
|
+
UPPER_CASE = "#{upperCase}",
|
|
17
|
+
SNAKE_CASE = "#{snakeCase}",
|
|
18
|
+
UPPER_SNAKE_CASE = "#{upperSnakeCase}",
|
|
19
|
+
LOWER_CASE = "#{lowerCase}",
|
|
20
|
+
SENTENCE_CASE = "#{sentenceCase}",
|
|
21
|
+
FIRST_CASE = "#{firstCase}",
|
|
22
|
+
CAMEL_CASE = "#{camelCase}",
|
|
23
|
+
PASCAL_CASE = "#{pascalCase}",
|
|
24
|
+
KEBAB_CASE = "#{kebabCase}",
|
|
25
|
+
UPPER_KEBAB_CASE = "#{upperKebabCase}",
|
|
26
|
+
TITLE_CASE = "#{titleCase}",
|
|
27
|
+
LOWER_CASE_BREAK = "#{lowerCaseBreak}",
|
|
28
|
+
UPPER_CASE_BREAK = "#{upperCaseBreak}",
|
|
29
|
+
FIRST_CASE_BREAK = "#{firstCaseBreak}",
|
|
30
|
+
SINGULAR = "#{singular}",
|
|
31
|
+
NUMBER = "#{number}",
|
|
32
|
+
HTML_TO_TEXT = "#{htmlToText}"
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemplateTag = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Template tags for string transformations
|
|
6
|
+
*
|
|
7
|
+
* This enum defines all available template tags that can be used with the `applyTemplate`
|
|
8
|
+
* and `applyTemplates` functions. Each tag corresponds to a specific string transformation
|
|
9
|
+
* function from the string.utils module.
|
|
10
|
+
*
|
|
11
|
+
* Template tags are represented as strings in the format `#{transformationName}`. When these
|
|
12
|
+
* tags appear in template strings, they are replaced with the result of applying the
|
|
13
|
+
* corresponding transformation to the provided value.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link applyTemplate} For applying a single value to a template
|
|
16
|
+
* @see {@link applyTemplates} For applying multiple values to a template
|
|
17
|
+
*/
|
|
18
|
+
var TemplateTag;
|
|
19
|
+
(function (TemplateTag) {
|
|
20
|
+
TemplateTag["UPPER_CASE"] = "#{upperCase}";
|
|
21
|
+
TemplateTag["SNAKE_CASE"] = "#{snakeCase}";
|
|
22
|
+
TemplateTag["UPPER_SNAKE_CASE"] = "#{upperSnakeCase}";
|
|
23
|
+
TemplateTag["LOWER_CASE"] = "#{lowerCase}";
|
|
24
|
+
TemplateTag["SENTENCE_CASE"] = "#{sentenceCase}";
|
|
25
|
+
TemplateTag["FIRST_CASE"] = "#{firstCase}";
|
|
26
|
+
TemplateTag["CAMEL_CASE"] = "#{camelCase}";
|
|
27
|
+
TemplateTag["PASCAL_CASE"] = "#{pascalCase}";
|
|
28
|
+
TemplateTag["KEBAB_CASE"] = "#{kebabCase}";
|
|
29
|
+
TemplateTag["UPPER_KEBAB_CASE"] = "#{upperKebabCase}";
|
|
30
|
+
TemplateTag["TITLE_CASE"] = "#{titleCase}";
|
|
31
|
+
TemplateTag["LOWER_CASE_BREAK"] = "#{lowerCaseBreak}";
|
|
32
|
+
TemplateTag["UPPER_CASE_BREAK"] = "#{upperCaseBreak}";
|
|
33
|
+
TemplateTag["FIRST_CASE_BREAK"] = "#{firstCaseBreak}";
|
|
34
|
+
TemplateTag["SINGULAR"] = "#{singular}";
|
|
35
|
+
TemplateTag["NUMBER"] = "#{number}";
|
|
36
|
+
TemplateTag["HTML_TO_TEXT"] = "#{htmlToText}";
|
|
37
|
+
// FORMAT = "#{format}",
|
|
38
|
+
})(TemplateTag || (exports.TemplateTag = TemplateTag = {}));
|
|
39
|
+
//# sourceMappingURL=template-tag.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-tag.enum.js","sourceRoot":"","sources":["../../../../libs/utils/src/enums/template-tag.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,IAAY,WAmBX;AAnBD,WAAY,WAAW;IACnB,0CAA2B,CAAA;IAC3B,0CAA2B,CAAA;IAC3B,qDAAsC,CAAA;IACtC,0CAA2B,CAAA;IAC3B,gDAAiC,CAAA;IACjC,0CAA2B,CAAA;IAC3B,0CAA2B,CAAA;IAC3B,4CAA6B,CAAA;IAC7B,0CAA2B,CAAA;IAC3B,qDAAsC,CAAA;IACtC,0CAA2B,CAAA;IAC3B,qDAAsC,CAAA;IACtC,qDAAsC,CAAA;IACtC,qDAAsC,CAAA;IACtC,uCAAwB,CAAA;IACxB,mCAAoB,CAAA;IACpB,6CAA8B,CAAA;IAC9B,wBAAwB;AAC5B,CAAC,EAnBW,WAAW,2BAAX,WAAW,QAmBtB"}
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./utils"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./interfaces"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./enums"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./constants"), exports);
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/utils/src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,uDAA6B;AAC7B,kDAAwB;AACxB,kDAAwB;AACxB,sDAA4B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./path-value-set.interface"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./infinite-object.interface"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./inflection-rule.interfaces"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/utils/src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,qEAA2C;AAC3C,sEAA4C;AAC5C,uEAA6C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an object with infinite nesting capability (recursive object type).
|
|
3
|
+
*
|
|
4
|
+
* This interface defines a recursive type that allows for objects with arbitrary depth of nesting,
|
|
5
|
+
* where each property value can itself be another infinitely-nestable object. This pattern is useful
|
|
6
|
+
* for representing hierarchical data structures, configuration objects, or any data that requires
|
|
7
|
+
* unlimited nesting depth.
|
|
8
|
+
*
|
|
9
|
+
* The interface uses TypeScript's index signature to allow any string key, with values that
|
|
10
|
+
* must be of the same InfiniteObject type, creating the recursive structure.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* While this interface allows for infinite nesting in theory, practical limitations apply:
|
|
14
|
+
* - JavaScript engine stack size limits may cause errors with extremely deep nesting
|
|
15
|
+
* - Performance degrades with very deep object hierarchies
|
|
16
|
+
* - Serialization/deserialization of deeply nested objects may be problematic
|
|
17
|
+
*
|
|
18
|
+
* This type is often used in conjunction with utility functions for traversing, flattening,
|
|
19
|
+
* or manipulating deeply nested object structures.
|
|
20
|
+
*
|
|
21
|
+
* @see PathValueSet A flattened representation of nested objects
|
|
22
|
+
* @see {@link objectToPathValueSet} Utility to convert nested objects to PathValueSet
|
|
23
|
+
* @see {@link pathValueSetToObject} Utility to convert PathValueSet back to nested objects
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // Creating a deeply nested object
|
|
28
|
+
* const nestedObj: InfiniteObject = {
|
|
29
|
+
* level1: {
|
|
30
|
+
* level2: {
|
|
31
|
+
* level3: {
|
|
32
|
+
* property: {
|
|
33
|
+
* value: {
|
|
34
|
+
* // Can continue nesting indefinitely
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
* };
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export interface InfiniteObject {
|
|
44
|
+
[key: string]: InfiniteObject;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infinite-object.interface.js","sourceRoot":"","sources":["../../../../libs/utils/src/interfaces/infinite-object.interface.ts"],"names":[],"mappings":""}
|