nhb-toolbox 4.13.3 → 4.13.4
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.
|
@@ -126,9 +126,6 @@ class Pluralizer {
|
|
|
126
126
|
addSingularRule(rule, replacement) {
|
|
127
127
|
this.#singularRules.push([rule, replacement]);
|
|
128
128
|
}
|
|
129
|
-
addUncountable(word) {
|
|
130
|
-
this.#uncountables.add(typeof word === 'string' ? word?.toLowerCase() : word);
|
|
131
|
-
}
|
|
132
129
|
/**
|
|
133
130
|
* * Add a word or pattern that should never change between singular and plural.
|
|
134
131
|
* @param word A word or regex pattern.
|
|
@@ -136,6 +133,16 @@ class Pluralizer {
|
|
|
136
133
|
* pluralizer.addUncountable('fish');
|
|
137
134
|
* pluralizer.addUncountable(/pok[eé]mon$/i);
|
|
138
135
|
*/
|
|
136
|
+
addUncountable(word) {
|
|
137
|
+
this.#uncountables.add(typeof word === 'string' ? word?.toLowerCase() : word);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* * Add a custom irregular form.
|
|
141
|
+
* @param single Singular word.
|
|
142
|
+
* @param plural Plural word.
|
|
143
|
+
* @example
|
|
144
|
+
* pluralizer.addIrregular('person', 'people');
|
|
145
|
+
*/
|
|
139
146
|
addIrregular(single, plural) {
|
|
140
147
|
const singleLower = single?.toLowerCase();
|
|
141
148
|
const pluralLower = plural?.toLowerCase();
|
|
@@ -42,7 +42,6 @@ export declare class Pluralizer {
|
|
|
42
42
|
* pluralizer.addSingularRule(/(matr)ices$/i, '$1ix');
|
|
43
43
|
*/
|
|
44
44
|
addSingularRule(rule: RegExp, replacement: string): void;
|
|
45
|
-
addUncountable(word: string | RegExp): void;
|
|
46
45
|
/**
|
|
47
46
|
* * Add a word or pattern that should never change between singular and plural.
|
|
48
47
|
* @param word A word or regex pattern.
|
|
@@ -50,6 +49,14 @@ export declare class Pluralizer {
|
|
|
50
49
|
* pluralizer.addUncountable('fish');
|
|
51
50
|
* pluralizer.addUncountable(/pok[eé]mon$/i);
|
|
52
51
|
*/
|
|
52
|
+
addUncountable(word: string | RegExp): void;
|
|
53
|
+
/**
|
|
54
|
+
* * Add a custom irregular form.
|
|
55
|
+
* @param single Singular word.
|
|
56
|
+
* @param plural Plural word.
|
|
57
|
+
* @example
|
|
58
|
+
* pluralizer.addIrregular('person', 'people');
|
|
59
|
+
*/
|
|
53
60
|
addIrregular(single: string, plural: string): void;
|
|
54
61
|
/**
|
|
55
62
|
* * Get the proper singular or plural form based on optional count.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pluralizer.d.ts","sourceRoot":"","sources":["../../../src/pluralize/Pluralizer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAgB,gBAAgB,EAAiB,MAAM,SAAS,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,UAAU;;IAOtB;;;OAGG;;IAoFH;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAItD;;;;;;OAMG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAIxD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAM3C;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAOlD;;;;;;;;OAQG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM;IAY/D;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiB9B;;;;;;OAMG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiBhC;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAO/B;;;;;;OAMG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAMjC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,UAAU,YAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"Pluralizer.d.ts","sourceRoot":"","sources":["../../../src/pluralize/Pluralizer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAgB,gBAAgB,EAAiB,MAAM,SAAS,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,UAAU;;IAOtB;;;OAGG;;IAoFH;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAItD;;;;;;OAMG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAIxD;;;;;;OAMG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAM3C;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAOlD;;;;;;;;OAQG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM;IAY/D;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiB9B;;;;;;OAMG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiBhC;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAO/B;;;;;;OAMG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAMjC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,UAAU,YAAmB,CAAC"}
|
|
@@ -123,9 +123,6 @@ export class Pluralizer {
|
|
|
123
123
|
addSingularRule(rule, replacement) {
|
|
124
124
|
this.#singularRules.push([rule, replacement]);
|
|
125
125
|
}
|
|
126
|
-
addUncountable(word) {
|
|
127
|
-
this.#uncountables.add(typeof word === 'string' ? word?.toLowerCase() : word);
|
|
128
|
-
}
|
|
129
126
|
/**
|
|
130
127
|
* * Add a word or pattern that should never change between singular and plural.
|
|
131
128
|
* @param word A word or regex pattern.
|
|
@@ -133,6 +130,16 @@ export class Pluralizer {
|
|
|
133
130
|
* pluralizer.addUncountable('fish');
|
|
134
131
|
* pluralizer.addUncountable(/pok[eé]mon$/i);
|
|
135
132
|
*/
|
|
133
|
+
addUncountable(word) {
|
|
134
|
+
this.#uncountables.add(typeof word === 'string' ? word?.toLowerCase() : word);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* * Add a custom irregular form.
|
|
138
|
+
* @param single Singular word.
|
|
139
|
+
* @param plural Plural word.
|
|
140
|
+
* @example
|
|
141
|
+
* pluralizer.addIrregular('person', 'people');
|
|
142
|
+
*/
|
|
136
143
|
addIrregular(single, plural) {
|
|
137
144
|
const singleLower = single?.toLowerCase();
|
|
138
145
|
const pluralLower = plural?.toLowerCase();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nhb-toolbox",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.4",
|
|
4
4
|
"description": "A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|