@mongez/reinforcements 2.3.1 → 2.3.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.
- package/README.md +2 -0
- package/cjs/Random/random.d.ts +35 -35
- package/cjs/Random/random.js +65 -67
- package/cjs/Random/random.test.d.ts +2 -0
- package/cjs/array/average.d.ts +6 -6
- package/cjs/array/average.js +12 -15
- package/cjs/array/average.test.d.ts +2 -0
- package/cjs/array/chunk.d.ts +4 -4
- package/cjs/array/chunk.js +13 -15
- package/cjs/array/chunk.test.d.ts +2 -0
- package/cjs/array/count.d.ts +4 -4
- package/cjs/array/count.js +14 -17
- package/cjs/array/count.test.d.ts +2 -0
- package/cjs/array/countBy.d.ts +6 -6
- package/cjs/array/countBy.js +20 -23
- package/cjs/array/countBy.test.d.ts +2 -0
- package/cjs/array/even.d.ts +6 -6
- package/cjs/array/even.js +15 -18
- package/cjs/array/even.test.d.ts +2 -0
- package/cjs/array/evenIndexes.d.ts +4 -4
- package/cjs/array/evenIndexes.js +9 -11
- package/cjs/array/evenIndexes.test.d.ts +2 -0
- package/cjs/array/groupBy.d.ts +7 -7
- package/cjs/array/groupBy.js +45 -48
- package/cjs/array/groupBy.test.d.ts +2 -0
- package/cjs/array/max.d.ts +6 -6
- package/cjs/array/max.js +20 -23
- package/cjs/array/max.test.d.ts +2 -0
- package/cjs/array/median.d.ts +6 -6
- package/cjs/array/median.js +25 -28
- package/cjs/array/median.test.d.ts +2 -0
- package/cjs/array/min.d.ts +6 -6
- package/cjs/array/min.js +20 -23
- package/cjs/array/min.test.d.ts +2 -0
- package/cjs/array/odd.d.ts +6 -6
- package/cjs/array/odd.js +15 -18
- package/cjs/array/odd.test.d.ts +2 -0
- package/cjs/array/oddIndexes.d.ts +4 -4
- package/cjs/array/oddIndexes.js +9 -11
- package/cjs/array/oddIndexes.test.d.ts +2 -0
- package/cjs/array/pluck.d.ts +8 -8
- package/cjs/array/pluck.js +23 -26
- package/cjs/array/pluck.test.d.ts +2 -0
- package/cjs/array/pushUnique.d.ts +5 -5
- package/cjs/array/pushUnique.js +14 -16
- package/cjs/array/pushUnique.test.d.ts +2 -0
- package/cjs/array/range.d.ts +4 -4
- package/cjs/array/range.js +21 -23
- package/cjs/array/range.test.d.ts +2 -0
- package/cjs/array/sum.d.ts +6 -6
- package/cjs/array/sum.js +28 -31
- package/cjs/array/sum.test.d.ts +2 -0
- package/cjs/array/unique.d.ts +4 -4
- package/cjs/array/unique.js +14 -17
- package/cjs/array/unique.test.d.ts +2 -0
- package/cjs/array/unshiftUnique.d.ts +5 -5
- package/cjs/array/unshiftUnique.js +14 -16
- package/cjs/array/unshiftUnique.test.d.ts +2 -0
- package/cjs/index.d.ts +56 -56
- package/cjs/index.js +56 -59
- package/cjs/mixed/areEqual/areEqual.d.ts +4 -4
- package/cjs/mixed/areEqual/areEqual.js +23 -25
- package/cjs/mixed/areEqual/areEqual.test.d.ts +2 -0
- package/cjs/mixed/clone/clone.d.ts +4 -4
- package/cjs/mixed/clone/clone.js +12 -18
- package/cjs/mixed/clone/clone.test.d.ts +2 -0
- package/cjs/mixed/shuffle/shuffle.d.ts +4 -4
- package/cjs/mixed/shuffle/shuffle.js +14 -16
- package/cjs/mixed/shuffle/shuffle.test.d.ts +2 -0
- package/cjs/number/round.d.ts +4 -4
- package/cjs/number/round.js +9 -11
- package/cjs/object/except.d.ts +4 -4
- package/cjs/object/except.js +12 -15
- package/cjs/object/except.test.d.ts +2 -0
- package/cjs/object/flatten.d.ts +4 -4
- package/cjs/object/flatten.js +38 -40
- package/cjs/object/flatten.test.d.ts +2 -0
- package/cjs/object/get.d.ts +4 -4
- package/cjs/object/get.js +24 -26
- package/cjs/object/get.test.d.ts +2 -0
- package/cjs/object/map.d.ts +4 -4
- package/cjs/object/map.js +10 -12
- package/cjs/object/merge.d.ts +1 -1
- package/cjs/object/merge.js +99 -104
- package/cjs/object/merge.test.d.ts +2 -0
- package/cjs/object/only.d.ts +4 -4
- package/cjs/object/only.js +17 -20
- package/cjs/object/only.test.d.ts +2 -0
- package/cjs/object/set.d.ts +5 -5
- package/cjs/object/set.js +28 -30
- package/cjs/object/set.test.d.ts +2 -0
- package/cjs/object/sort.d.ts +4 -4
- package/cjs/object/sort.js +15 -17
- package/cjs/object/unset.d.ts +4 -4
- package/cjs/object/unset.js +23 -26
- package/cjs/object/unset.test.d.ts +2 -0
- package/cjs/string/capitalize.d.ts +6 -6
- package/cjs/string/capitalize.js +15 -18
- package/cjs/string/extension.d.ts +4 -4
- package/cjs/string/extension.js +11 -13
- package/cjs/string/initials.d.ts +4 -4
- package/cjs/string/initials.js +15 -17
- package/cjs/string/initials.test.d.ts +2 -0
- package/cjs/string/ltrim.d.ts +7 -7
- package/cjs/string/ltrim.js +15 -18
- package/cjs/string/readMoreChars.d.ts +5 -5
- package/cjs/string/readMoreChars.js +11 -13
- package/cjs/string/readMoreWords.d.ts +5 -5
- package/cjs/string/readMoreWords.js +14 -16
- package/cjs/string/removeFirst.d.ts +7 -7
- package/cjs/string/removeFirst.js +13 -16
- package/cjs/string/removeLast.d.ts +7 -7
- package/cjs/string/removeLast.js +13 -16
- package/cjs/string/repeatsOf.d.ts +7 -7
- package/cjs/string/repeatsOf.js +17 -19
- package/cjs/string/replaceAll.d.ts +8 -8
- package/cjs/string/replaceAll.js +14 -17
- package/cjs/string/replaceFirst.d.ts +8 -8
- package/cjs/string/replaceFirst.js +14 -17
- package/cjs/string/replaceLast.d.ts +8 -8
- package/cjs/string/replaceLast.js +21 -23
- package/cjs/string/rtrim.d.ts +7 -7
- package/cjs/string/rtrim.js +15 -18
- package/cjs/string/startsWithArabic.d.ts +2 -2
- package/cjs/string/startsWithArabic.js +13 -17
- package/cjs/string/toCamelCase.d.ts +1 -1
- package/cjs/string/toCamelCase.js +11 -14
- package/cjs/string/toCamelCase.test.d.ts +2 -0
- package/cjs/string/toInputName.d.ts +5 -5
- package/cjs/string/toInputName.js +21 -24
- package/cjs/string/toKebabCase.d.ts +4 -4
- package/cjs/string/toKebabCase.js +10 -13
- package/cjs/string/toKebabCase.test.d.ts +2 -0
- package/cjs/string/toSnakeCase.d.ts +7 -7
- package/cjs/string/toSnakeCase.js +20 -22
- package/cjs/string/toSnakeCase.test.d.ts +2 -0
- package/cjs/string/toStudlyCase.d.ts +9 -9
- package/cjs/string/toStudlyCase.js +19 -22
- package/cjs/string/trim.d.ts +7 -7
- package/cjs/string/trim.js +19 -22
- package/cjs/string/ucfirst.d.ts +6 -6
- package/cjs/string/ucfirst.js +11 -13
- package/cjs/types.d.ts +1 -1
- package/cjs/utils/debounce.d.ts +8 -8
- package/cjs/utils/debounce.js +16 -18
- package/cjs/utils/escapeRegex.d.ts +4 -4
- package/cjs/utils/escapeRegex.js +8 -10
- package/cjs/utils/escapeRegex.test.d.ts +2 -0
- package/esm/Random/random.d.ts +35 -35
- package/esm/Random/random.js +64 -65
- package/esm/Random/random.test.d.ts +2 -0
- package/esm/array/average.d.ts +6 -6
- package/esm/array/average.js +11 -13
- package/esm/array/average.test.d.ts +2 -0
- package/esm/array/chunk.d.ts +4 -4
- package/esm/array/chunk.js +12 -13
- package/esm/array/chunk.test.d.ts +2 -0
- package/esm/array/count.d.ts +4 -4
- package/esm/array/count.js +13 -15
- package/esm/array/count.test.d.ts +2 -0
- package/esm/array/countBy.d.ts +6 -6
- package/esm/array/countBy.js +19 -21
- package/esm/array/countBy.test.d.ts +2 -0
- package/esm/array/even.d.ts +6 -6
- package/esm/array/even.js +14 -16
- package/esm/array/even.test.d.ts +2 -0
- package/esm/array/evenIndexes.d.ts +4 -4
- package/esm/array/evenIndexes.js +8 -9
- package/esm/array/evenIndexes.test.d.ts +2 -0
- package/esm/array/groupBy.d.ts +7 -7
- package/esm/array/groupBy.js +44 -46
- package/esm/array/groupBy.test.d.ts +2 -0
- package/esm/array/max.d.ts +6 -6
- package/esm/array/max.js +19 -21
- package/esm/array/max.test.d.ts +2 -0
- package/esm/array/median.d.ts +6 -6
- package/esm/array/median.js +24 -26
- package/esm/array/median.test.d.ts +2 -0
- package/esm/array/min.d.ts +6 -6
- package/esm/array/min.js +19 -21
- package/esm/array/min.test.d.ts +2 -0
- package/esm/array/odd.d.ts +6 -6
- package/esm/array/odd.js +14 -16
- package/esm/array/odd.test.d.ts +2 -0
- package/esm/array/oddIndexes.d.ts +4 -4
- package/esm/array/oddIndexes.js +8 -9
- package/esm/array/oddIndexes.test.d.ts +2 -0
- package/esm/array/pluck.d.ts +8 -8
- package/esm/array/pluck.js +22 -24
- package/esm/array/pluck.test.d.ts +2 -0
- package/esm/array/pushUnique.d.ts +5 -5
- package/esm/array/pushUnique.js +13 -14
- package/esm/array/pushUnique.test.d.ts +2 -0
- package/esm/array/range.d.ts +4 -4
- package/esm/array/range.js +20 -21
- package/esm/array/range.test.d.ts +2 -0
- package/esm/array/sum.d.ts +6 -6
- package/esm/array/sum.js +27 -29
- package/esm/array/sum.test.d.ts +2 -0
- package/esm/array/unique.d.ts +4 -4
- package/esm/array/unique.js +13 -15
- package/esm/array/unique.test.d.ts +2 -0
- package/esm/array/unshiftUnique.d.ts +5 -5
- package/esm/array/unshiftUnique.js +13 -14
- package/esm/array/unshiftUnique.test.d.ts +2 -0
- package/esm/index.d.ts +56 -56
- package/esm/mixed/areEqual/areEqual.d.ts +4 -4
- package/esm/mixed/areEqual/areEqual.js +22 -23
- package/esm/mixed/areEqual/areEqual.test.d.ts +2 -0
- package/esm/mixed/clone/clone.d.ts +4 -4
- package/esm/mixed/clone/clone.js +11 -16
- package/esm/mixed/clone/clone.test.d.ts +2 -0
- package/esm/mixed/shuffle/shuffle.d.ts +4 -4
- package/esm/mixed/shuffle/shuffle.js +13 -14
- package/esm/mixed/shuffle/shuffle.test.d.ts +2 -0
- package/esm/number/round.d.ts +4 -4
- package/esm/number/round.js +8 -9
- package/esm/object/except.d.ts +4 -4
- package/esm/object/except.js +11 -13
- package/esm/object/except.test.d.ts +2 -0
- package/esm/object/flatten.d.ts +4 -4
- package/esm/object/flatten.js +37 -38
- package/esm/object/flatten.test.d.ts +2 -0
- package/esm/object/get.d.ts +4 -4
- package/esm/object/get.js +23 -24
- package/esm/object/get.test.d.ts +2 -0
- package/esm/object/map.d.ts +4 -4
- package/esm/object/map.js +9 -10
- package/esm/object/merge.d.ts +1 -1
- package/esm/object/merge.js +94 -96
- package/esm/object/merge.test.d.ts +2 -0
- package/esm/object/only.d.ts +4 -4
- package/esm/object/only.js +16 -18
- package/esm/object/only.test.d.ts +2 -0
- package/esm/object/set.d.ts +5 -5
- package/esm/object/set.js +27 -28
- package/esm/object/set.test.d.ts +2 -0
- package/esm/object/sort.d.ts +4 -4
- package/esm/object/sort.js +14 -15
- package/esm/object/unset.d.ts +4 -4
- package/esm/object/unset.js +22 -24
- package/esm/object/unset.test.d.ts +2 -0
- package/esm/string/capitalize.d.ts +6 -6
- package/esm/string/capitalize.js +14 -16
- package/esm/string/extension.d.ts +4 -4
- package/esm/string/extension.js +10 -11
- package/esm/string/initials.d.ts +4 -4
- package/esm/string/initials.js +14 -15
- package/esm/string/initials.test.d.ts +2 -0
- package/esm/string/ltrim.d.ts +7 -7
- package/esm/string/ltrim.js +14 -16
- package/esm/string/readMoreChars.d.ts +5 -5
- package/esm/string/readMoreChars.js +10 -11
- package/esm/string/readMoreWords.d.ts +5 -5
- package/esm/string/readMoreWords.js +13 -14
- package/esm/string/removeFirst.d.ts +7 -7
- package/esm/string/removeFirst.js +12 -14
- package/esm/string/removeLast.d.ts +7 -7
- package/esm/string/removeLast.js +12 -14
- package/esm/string/repeatsOf.d.ts +7 -7
- package/esm/string/repeatsOf.js +16 -17
- package/esm/string/replaceAll.d.ts +8 -8
- package/esm/string/replaceAll.js +13 -15
- package/esm/string/replaceFirst.d.ts +8 -8
- package/esm/string/replaceFirst.js +13 -15
- package/esm/string/replaceLast.d.ts +8 -8
- package/esm/string/replaceLast.js +20 -21
- package/esm/string/rtrim.d.ts +7 -7
- package/esm/string/rtrim.js +14 -16
- package/esm/string/startsWithArabic.d.ts +2 -2
- package/esm/string/startsWithArabic.js +10 -12
- package/esm/string/toCamelCase.d.ts +1 -1
- package/esm/string/toCamelCase.js +10 -12
- package/esm/string/toCamelCase.test.d.ts +2 -0
- package/esm/string/toInputName.d.ts +5 -5
- package/esm/string/toInputName.js +20 -22
- package/esm/string/toKebabCase.d.ts +4 -4
- package/esm/string/toKebabCase.js +9 -11
- package/esm/string/toKebabCase.test.d.ts +2 -0
- package/esm/string/toSnakeCase.d.ts +7 -7
- package/esm/string/toSnakeCase.js +19 -20
- package/esm/string/toSnakeCase.test.d.ts +2 -0
- package/esm/string/toStudlyCase.d.ts +9 -9
- package/esm/string/toStudlyCase.js +18 -20
- package/esm/string/trim.d.ts +7 -7
- package/esm/string/trim.js +18 -20
- package/esm/string/ucfirst.d.ts +6 -6
- package/esm/string/ucfirst.js +10 -11
- package/esm/types.d.ts +1 -1
- package/esm/utils/debounce.d.ts +8 -8
- package/esm/utils/debounce.js +15 -16
- package/esm/utils/escapeRegex.d.ts +4 -4
- package/esm/utils/escapeRegex.js +7 -8
- package/esm/utils/escapeRegex.test.d.ts +2 -0
- package/package.json +1 -1
package/cjs/string/initials.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the initials of the given name
|
|
3
|
-
*/
|
|
4
|
-
export default function initials(name: string, separator?: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Get the initials of the given name
|
|
3
|
+
*/
|
|
4
|
+
export default function initials(name: string, separator?: string): string;
|
|
5
5
|
//# sourceMappingURL=initials.d.ts.map
|
package/cjs/string/initials.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
module.exports = initials;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Get the initials of the given name
|
|
4
|
+
*/
|
|
5
|
+
function initials(name, separator = "") {
|
|
6
|
+
if (!name) return "";
|
|
7
|
+
if (typeof name !== "string") {
|
|
8
|
+
throw new Error("The name must be a string");
|
|
9
|
+
}
|
|
10
|
+
return name
|
|
11
|
+
.split(" ")
|
|
12
|
+
.map(name => name.charAt(0))
|
|
13
|
+
.join(separator);
|
|
14
|
+
}
|
|
15
|
+
module.exports = initials;
|
package/cjs/string/ltrim.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remove the given needle from the start of string
|
|
3
|
-
*
|
|
4
|
-
* @param string needle
|
|
5
|
-
* @return string
|
|
6
|
-
*/
|
|
7
|
-
export default function ltrim(string: string, needle?: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Remove the given needle from the start of string
|
|
3
|
+
*
|
|
4
|
+
* @param string needle
|
|
5
|
+
* @return string
|
|
6
|
+
*/
|
|
7
|
+
export default function ltrim(string: string, needle?: string): string;
|
|
8
8
|
//# sourceMappingURL=ltrim.d.ts.map
|
package/cjs/string/ltrim.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
module.exports = ltrim;
|
|
1
|
+
"use strict";
|
|
2
|
+
var escapeRegex = require("../utils/escapeRegex.js");
|
|
3
|
+
/**
|
|
4
|
+
* Remove the given needle from the start of string
|
|
5
|
+
*
|
|
6
|
+
* @param string needle
|
|
7
|
+
* @return string
|
|
8
|
+
*/
|
|
9
|
+
function ltrim(string, needle = " ") {
|
|
10
|
+
if (!string) return "";
|
|
11
|
+
const pattern = "^" + escapeRegex(needle) + "+",
|
|
12
|
+
regex = new RegExp(pattern, "g");
|
|
13
|
+
return string.replace(regex, "");
|
|
14
|
+
}
|
|
15
|
+
module.exports = ltrim;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cut string for the given length and append ... if string is larger than the given length
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
export default function readMoreChars(string: string, length: number, readMoreDots?: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Cut string for the given length and append ... if string is larger than the given length
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export default function readMoreChars(string: string, length: number, readMoreDots?: string): string;
|
|
6
6
|
//# sourceMappingURL=readMoreChars.d.ts.map
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
module.exports = readMoreChars;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cut string for the given length and append ... if string is larger than the given length
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
function readMoreChars(string, length, readMoreDots = "...") {
|
|
7
|
+
if (!string) return "";
|
|
8
|
+
if (string.length <= length) return string;
|
|
9
|
+
return string.substring(0, length) + readMoreDots;
|
|
10
|
+
}
|
|
11
|
+
module.exports = readMoreChars;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cut string for the given spaces and append ... if string is larger than the given length
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
export default function readMoreWords(string: string, length: number, readMoreDots?: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Cut string for the given spaces and append ... if string is larger than the given length
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export default function readMoreWords(string: string, length: number, readMoreDots?: string): string;
|
|
6
6
|
//# sourceMappingURL=readMoreWords.d.ts.map
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
module.exports = readMoreWords;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cut string for the given spaces and append ... if string is larger than the given length
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
function readMoreWords(string, length, readMoreDots = "...") {
|
|
7
|
+
if (!string) return "";
|
|
8
|
+
const wordsList = string.split(" ");
|
|
9
|
+
const words = wordsList.slice(0, length);
|
|
10
|
+
return (
|
|
11
|
+
words.join(" ") + (words.length < wordsList.length ? readMoreDots : "")
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
module.exports = readMoreWords;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remove the first occurrence for the the give needle
|
|
3
|
-
*
|
|
4
|
-
* @param string needle
|
|
5
|
-
* @return string
|
|
6
|
-
*/
|
|
7
|
-
export default function removeFirst(string: string, needle: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Remove the first occurrence for the the give needle
|
|
3
|
+
*
|
|
4
|
+
* @param string needle
|
|
5
|
+
* @return string
|
|
6
|
+
*/
|
|
7
|
+
export default function removeFirst(string: string, needle: string): string;
|
|
8
8
|
//# sourceMappingURL=removeFirst.d.ts.map
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = removeFirst;
|
|
1
|
+
"use strict";
|
|
2
|
+
var replaceFirst = require("./replaceFirst.js");
|
|
3
|
+
/**
|
|
4
|
+
* Remove the first occurrence for the the give needle
|
|
5
|
+
*
|
|
6
|
+
* @param string needle
|
|
7
|
+
* @return string
|
|
8
|
+
*/
|
|
9
|
+
function removeFirst(string, needle) {
|
|
10
|
+
if (!string) return "";
|
|
11
|
+
return replaceFirst(string, needle, "");
|
|
12
|
+
}
|
|
13
|
+
module.exports = removeFirst;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remove the last occurrence for the the give needle
|
|
3
|
-
*
|
|
4
|
-
* @param string needle
|
|
5
|
-
* @return string
|
|
6
|
-
*/
|
|
7
|
-
export default function removeLast(string: string, needle: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Remove the last occurrence for the the give needle
|
|
3
|
+
*
|
|
4
|
+
* @param string needle
|
|
5
|
+
* @return string
|
|
6
|
+
*/
|
|
7
|
+
export default function removeLast(string: string, needle: string): string;
|
|
8
8
|
//# sourceMappingURL=removeLast.d.ts.map
|
package/cjs/string/removeLast.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = removeLast;
|
|
1
|
+
"use strict";
|
|
2
|
+
var replaceLast = require("./replaceLast.js");
|
|
3
|
+
/**
|
|
4
|
+
* Remove the last occurrence for the the give needle
|
|
5
|
+
*
|
|
6
|
+
* @param string needle
|
|
7
|
+
* @return string
|
|
8
|
+
*/
|
|
9
|
+
function removeLast(string, needle) {
|
|
10
|
+
if (!string) return "";
|
|
11
|
+
return replaceLast(string, needle, "");
|
|
12
|
+
}
|
|
13
|
+
module.exports = removeLast;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get total repeats of the given string
|
|
3
|
-
*
|
|
4
|
-
* @param string $needle
|
|
5
|
-
* @return int
|
|
6
|
-
*/
|
|
7
|
-
export default function repeatsOf(string: string, needle: string, caseSensitive?: boolean): number;
|
|
1
|
+
/**
|
|
2
|
+
* Get total repeats of the given string
|
|
3
|
+
*
|
|
4
|
+
* @param string $needle
|
|
5
|
+
* @return int
|
|
6
|
+
*/
|
|
7
|
+
export default function repeatsOf(string: string, needle: string, caseSensitive?: boolean): number;
|
|
8
8
|
//# sourceMappingURL=repeatsOf.d.ts.map
|
package/cjs/string/repeatsOf.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
module.exports = repeatsOf;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Get total repeats of the given string
|
|
4
|
+
*
|
|
5
|
+
* @param string $needle
|
|
6
|
+
* @return int
|
|
7
|
+
*/
|
|
8
|
+
function repeatsOf(string, needle, caseSensitive = true) {
|
|
9
|
+
if (!string) return 0;
|
|
10
|
+
let flags = "g";
|
|
11
|
+
if (caseSensitive === false) {
|
|
12
|
+
flags += "i";
|
|
13
|
+
}
|
|
14
|
+
const regex = new RegExp(`${needle}`, flags);
|
|
15
|
+
return string.split(regex).length - 1;
|
|
16
|
+
}
|
|
17
|
+
module.exports = repeatsOf;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Replace all matched occurrence with the given string
|
|
3
|
-
*
|
|
4
|
-
* @param string searchText
|
|
5
|
-
* @param string replacement
|
|
6
|
-
* @returns string
|
|
7
|
-
*/
|
|
8
|
-
export default function replaceAll(string: string, searchText: string, replacement: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Replace all matched occurrence with the given string
|
|
3
|
+
*
|
|
4
|
+
* @param string searchText
|
|
5
|
+
* @param string replacement
|
|
6
|
+
* @returns string
|
|
7
|
+
*/
|
|
8
|
+
export default function replaceAll(string: string, searchText: string, replacement: string): string;
|
|
9
9
|
//# sourceMappingURL=replaceAll.d.ts.map
|
package/cjs/string/replaceAll.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = replaceAll;
|
|
1
|
+
"use strict";
|
|
2
|
+
var escapeRegex = require("../utils/escapeRegex.js");
|
|
3
|
+
/**
|
|
4
|
+
* Replace all matched occurrence with the given string
|
|
5
|
+
*
|
|
6
|
+
* @param string searchText
|
|
7
|
+
* @param string replacement
|
|
8
|
+
* @returns string
|
|
9
|
+
*/
|
|
10
|
+
function replaceAll(string, searchText, replacement) {
|
|
11
|
+
if (!string) return "";
|
|
12
|
+
return string.replace(new RegExp(escapeRegex(searchText), "g"), replacement);
|
|
13
|
+
}
|
|
14
|
+
module.exports = replaceAll;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Replace the First occurrence for the the give needle
|
|
3
|
-
*
|
|
4
|
-
* @param string needle
|
|
5
|
-
* @param string replacement
|
|
6
|
-
* @return string
|
|
7
|
-
*/
|
|
8
|
-
export default function replaceFirst(string: string, needle: string, replacement: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Replace the First occurrence for the the give needle
|
|
3
|
+
*
|
|
4
|
+
* @param string needle
|
|
5
|
+
* @param string replacement
|
|
6
|
+
* @return string
|
|
7
|
+
*/
|
|
8
|
+
export default function replaceFirst(string: string, needle: string, replacement: string): string;
|
|
9
9
|
//# sourceMappingURL=replaceFirst.d.ts.map
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = replaceFirst;
|
|
1
|
+
"use strict";
|
|
2
|
+
var escapeRegex = require("../utils/escapeRegex.js");
|
|
3
|
+
/**
|
|
4
|
+
* Replace the First occurrence for the the give needle
|
|
5
|
+
*
|
|
6
|
+
* @param string needle
|
|
7
|
+
* @param string replacement
|
|
8
|
+
* @return string
|
|
9
|
+
*/
|
|
10
|
+
function replaceFirst(string, needle, replacement) {
|
|
11
|
+
if (!string) return "";
|
|
12
|
+
return string.replace(escapeRegex(needle), replacement);
|
|
13
|
+
}
|
|
14
|
+
module.exports = replaceFirst;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Replace the last occurrence for the the give needle
|
|
3
|
-
*
|
|
4
|
-
* @param string needle
|
|
5
|
-
* @param string replacement
|
|
6
|
-
* @return string
|
|
7
|
-
*/
|
|
8
|
-
export default function replaceLast(string: string, needle: string, replacement: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Replace the last occurrence for the the give needle
|
|
3
|
+
*
|
|
4
|
+
* @param string needle
|
|
5
|
+
* @param string replacement
|
|
6
|
+
* @return string
|
|
7
|
+
*/
|
|
8
|
+
export default function replaceLast(string: string, needle: string, replacement: string): string;
|
|
9
9
|
//# sourceMappingURL=replaceLast.d.ts.map
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param string
|
|
7
|
-
* @
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
module.exports = replaceLast;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Replace the last occurrence for the the give needle
|
|
4
|
+
*
|
|
5
|
+
* @param string needle
|
|
6
|
+
* @param string replacement
|
|
7
|
+
* @return string
|
|
8
|
+
*/
|
|
9
|
+
function replaceLast(string, needle, replacement) {
|
|
10
|
+
if (!string) return "";
|
|
11
|
+
const lastIndex = string.lastIndexOf(needle);
|
|
12
|
+
if (lastIndex < 0) {
|
|
13
|
+
return string;
|
|
14
|
+
}
|
|
15
|
+
return (
|
|
16
|
+
string.substr(0, lastIndex) +
|
|
17
|
+
replacement +
|
|
18
|
+
string.substr(lastIndex + needle.length)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
module.exports = replaceLast;
|
package/cjs/string/rtrim.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remove the given needle from the start of string
|
|
3
|
-
*
|
|
4
|
-
* @param string needle
|
|
5
|
-
* @return string
|
|
6
|
-
*/
|
|
7
|
-
export default function rtrim(string: string, needle?: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Remove the given needle from the start of string
|
|
3
|
+
*
|
|
4
|
+
* @param string needle
|
|
5
|
+
* @return string
|
|
6
|
+
*/
|
|
7
|
+
export default function rtrim(string: string, needle?: string): string;
|
|
8
8
|
//# sourceMappingURL=rtrim.d.ts.map
|
package/cjs/string/rtrim.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
module.exports = rtrim;
|
|
1
|
+
"use strict";
|
|
2
|
+
var escapeRegex = require("../utils/escapeRegex.js");
|
|
3
|
+
/**
|
|
4
|
+
* Remove the given needle from the start of string
|
|
5
|
+
*
|
|
6
|
+
* @param string needle
|
|
7
|
+
* @return string
|
|
8
|
+
*/
|
|
9
|
+
function rtrim(string, needle = " ") {
|
|
10
|
+
if (!string) return "";
|
|
11
|
+
const pattern = escapeRegex(needle) + "+$",
|
|
12
|
+
regex = new RegExp(pattern, "g");
|
|
13
|
+
return string.replace(regex, "");
|
|
14
|
+
}
|
|
15
|
+
module.exports = rtrim;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const ARABIC_PATTERN: RegExp;
|
|
2
|
-
export default function startsWithArabic(string: string, trimmed?: boolean): boolean;
|
|
1
|
+
export declare const ARABIC_PATTERN: RegExp;
|
|
2
|
+
export default function startsWithArabic(string: string, trimmed?: boolean): boolean;
|
|
3
3
|
//# sourceMappingURL=startsWithArabic.d.ts.map
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
exports.ARABIC_PATTERN = ARABIC_PATTERN;
|
|
17
|
-
exports["default"] = startsWithArabic;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var trim = require("./trim.js");
|
|
4
|
+
const ARABIC_PATTERN = /[\u0600-\u06FF]/;
|
|
5
|
+
function startsWithArabic(string, trimmed = true) {
|
|
6
|
+
if (!string) return false;
|
|
7
|
+
if (trimmed === true) {
|
|
8
|
+
string = trim(String(string));
|
|
9
|
+
}
|
|
10
|
+
return string.charAt(0).match(ARABIC_PATTERN) !== null;
|
|
11
|
+
}
|
|
12
|
+
exports.ARABIC_PATTERN = ARABIC_PATTERN;
|
|
13
|
+
exports.default = startsWithArabic;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function toCamelCase(string: string, separator?: string): string;
|
|
1
|
+
export default function toCamelCase(string: string, separator?: string): string;
|
|
2
2
|
//# sourceMappingURL=toCamelCase.d.ts.map
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = toCamelCase;
|
|
1
|
+
"use strict";
|
|
2
|
+
var capitalize = require("./capitalize.js");
|
|
3
|
+
function toCamelCase(string, separator = "\\s+|-|/|_|\\.") {
|
|
4
|
+
if (!string) return "";
|
|
5
|
+
const regex = new RegExp(separator + "|(?=[A-Z])", "g");
|
|
6
|
+
return string
|
|
7
|
+
.split(regex)
|
|
8
|
+
.map((word, index) => (index > 0 ? capitalize(word) : word.toLowerCase()))
|
|
9
|
+
.join("");
|
|
10
|
+
}
|
|
11
|
+
module.exports = toCamelCase;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert the current a dot notation string to compound input name
|
|
3
|
-
* my.input.name >> my[input][name]
|
|
4
|
-
*/
|
|
5
|
-
export default function toInputName(string: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Convert the current a dot notation string to compound input name
|
|
3
|
+
* my.input.name >> my[input][name]
|
|
4
|
+
*/
|
|
5
|
+
export default function toInputName(string: string): string;
|
|
6
6
|
//# sourceMappingURL=toInputName.d.ts.map
|