danholibraryjs 1.10.0 → 2.0.0
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/dist/Classes/DanhoLogger.d.ts +23 -0
- package/dist/Classes/DanhoLogger.js +65 -0
- package/dist/Classes/Events/EventEmitter.d.ts +1 -1
- package/dist/Classes/Events/EventEmitter.js +1 -1
- package/dist/Classes/Time/Date.d.ts +1 -0
- package/dist/Classes/Time/Date.js +4 -1
- package/dist/Classes/Time/Time.d.ts +5 -4
- package/dist/Classes/Time/Time.js +7 -4
- package/dist/Classes/index.d.ts +1 -0
- package/dist/Classes/index.js +1 -0
- package/dist/Classes/store.d.ts +5 -9
- package/dist/Extensions/Array/array.extension.d.ts +42 -0
- package/dist/Extensions/Array/array.extension.js +57 -0
- package/dist/Extensions/Array/crud.extension.d.ts +24 -0
- package/dist/Extensions/Array/crud.extension.js +28 -0
- package/dist/Extensions/Array/index.d.ts +20 -0
- package/dist/Extensions/Array/index.js +40 -0
- package/dist/Extensions/Array/loop.extension.d.ts +18 -0
- package/dist/Extensions/Array/loop.extension.js +23 -0
- package/dist/Extensions/Array/random.extension.d.ts +23 -0
- package/dist/Extensions/Array/random.extension.js +35 -0
- package/dist/Extensions/Array/sort.extension.d.ts +27 -0
- package/dist/Extensions/Array/sort.extension.js +31 -0
- package/dist/Extensions/Array/string.extension.d.ts +13 -0
- package/dist/Extensions/Array/string.extension.js +14 -0
- package/dist/Extensions/Array.d.ts +17 -3
- package/dist/Extensions/Array.js +0 -12
- package/dist/Extensions/Function.d.ts +17 -2
- package/dist/Extensions/Function.js +15 -2
- package/dist/Extensions/Number.d.ts +13 -0
- package/dist/Extensions/Number.js +40 -0
- package/dist/Extensions/Object/arrays.extension.d.ts +17 -0
- package/dist/Extensions/Object/arrays.extension.js +13 -0
- package/dist/Extensions/Object/booleans.extension.d.ts +18 -0
- package/dist/Extensions/Object/booleans.extension.js +37 -0
- package/dist/Extensions/Object/extracts.extension.d.ts +38 -0
- package/dist/Extensions/Object/extracts.extension.js +72 -0
- package/dist/Extensions/Object/index.d.ts +8 -47
- package/dist/Extensions/Object/index.js +31 -33
- package/dist/Extensions/Object/properties.extension.d.ts +6 -0
- package/dist/Extensions/Object/properties.extension.js +4 -0
- package/dist/Extensions/Object/properties.js +1 -2
- package/dist/Extensions/String/case.extension.d.ts +12 -0
- package/dist/Extensions/String/case.extension.js +55 -0
- package/dist/Extensions/String/index.d.ts +4 -0
- package/dist/Extensions/String/index.js +30 -0
- package/dist/Extensions/index.d.ts +1 -12
- package/dist/Extensions/index.js +1 -9
- package/dist/Types/Able.d.ts +16 -0
- package/dist/Types/Able.js +2 -0
- package/dist/Types/Array.d.ts +6 -0
- package/dist/Types/Array.js +2 -0
- package/dist/Types/C#.d.ts +8 -0
- package/dist/Types/C#.js +2 -0
- package/dist/Types/Date.d.ts +1 -1
- package/dist/Types/Events.d.ts +2 -2
- package/dist/Types/Function.d.ts +5 -0
- package/dist/Types/Function.js +2 -0
- package/dist/Types/Object.d.ts +4 -0
- package/dist/Types/Object.js +2 -0
- package/dist/Types/PropertiesWith.d.ts +21 -0
- package/dist/Types/String.d.ts +1 -0
- package/dist/Types/String.js +2 -0
- package/dist/Types/TransformTypes.d.ts +9 -0
- package/dist/Types/index.d.ts +6 -28
- package/dist/Types/index.js +6 -0
- package/dist/Utils/ApiUtil/ApiTypes.d.ts +15 -0
- package/dist/Utils/ApiUtil/ApiTypes.js +15 -0
- package/dist/Utils/ApiUtil/RequestUtil.d.ts +19 -0
- package/dist/Utils/ApiUtil/RequestUtil.js +73 -0
- package/dist/Utils/ApiUtil/index.d.ts +20 -0
- package/dist/Utils/ApiUtil/index.js +33 -0
- package/dist/Utils/ApiUtils/ApiTypes.d.ts +15 -0
- package/dist/Utils/ApiUtils/ApiTypes.js +15 -0
- package/dist/Utils/ApiUtils/RequestUtil.d.ts +19 -0
- package/dist/Utils/ApiUtils/RequestUtil.js +73 -0
- package/dist/Utils/ApiUtils/index.d.ts +20 -0
- package/dist/Utils/ApiUtils/index.js +33 -0
- package/dist/Utils/ColorUtils.d.ts +11 -0
- package/dist/Utils/ColorUtils.js +93 -0
- package/dist/Utils/FormUtil.d.ts +6 -0
- package/dist/Utils/FormUtil.js +35 -0
- package/dist/Utils/FormUtils.d.ts +6 -0
- package/dist/Utils/FormUtils.js +35 -0
- package/dist/Utils/NumberUtils.d.ts +1 -0
- package/dist/Utils/NumberUtils.js +7 -0
- package/dist/Utils/PatcherUtils.d.ts +6 -0
- package/dist/Utils/PatcherUtils.js +80 -0
- package/dist/Utils/StringUtils.d.ts +3 -0
- package/dist/Utils/StringUtils.js +47 -0
- package/dist/Utils/TimeUtils/debounce.util.d.ts +22 -0
- package/dist/Utils/TimeUtils/debounce.util.js +78 -0
- package/dist/Utils/TimeUtils/functions.util.d.ts +4 -0
- package/dist/Utils/TimeUtils/functions.util.js +21 -0
- package/dist/Utils/TimeUtils/index.d.ts +15 -0
- package/dist/Utils/TimeUtils/index.js +34 -0
- package/dist/Utils/TimeUtils/throttle.util.d.ts +15 -0
- package/dist/Utils/TimeUtils/throttle.util.js +43 -0
- package/dist/Utils/index.d.ts +7 -0
- package/dist/Utils/index.js +23 -0
- package/package.json +4 -2
- package/src/Classes/DanhoLogger.ts +78 -0
- package/src/Classes/Events/Event.ts +96 -96
- package/src/Classes/Events/EventCollection.ts +90 -90
- package/src/Classes/Events/EventEmitter.ts +68 -68
- package/src/Classes/Time/Date.ts +219 -216
- package/src/Classes/Time/Time.ts +109 -104
- package/src/Classes/Time/TimeSpan.ts +171 -171
- package/src/Classes/index.ts +1 -0
- package/src/Classes/store.ts +22 -22
- package/src/Extensions/Array/array.extension.ts +103 -0
- package/src/Extensions/Array/crud.extension.ts +46 -0
- package/src/Extensions/Array/index.ts +15 -0
- package/src/Extensions/Array/loop.extension.ts +38 -0
- package/src/Extensions/Array/random.extension.ts +56 -0
- package/src/Extensions/Array/sort.extension.ts +52 -0
- package/src/Extensions/Array/string.extension.ts +22 -0
- package/src/Extensions/Document.ts +39 -39
- package/src/Extensions/Function.ts +37 -10
- package/src/Extensions/Map.ts +56 -56
- package/src/Extensions/Number.ts +50 -0
- package/src/Extensions/Object/arrays.extension.ts +27 -0
- package/src/Extensions/Object/booleans.extension.ts +46 -0
- package/src/Extensions/Object/extracts.extension.ts +102 -0
- package/src/Extensions/Object/index.ts +9 -80
- package/src/Extensions/Object/properties.extension.ts +11 -0
- package/src/Extensions/Object/properties.ts +35 -36
- package/src/Extensions/String/case.extension.ts +95 -0
- package/src/Extensions/String/index.ts +5 -0
- package/src/Extensions/index.ts +2 -20
- package/src/Interfaces/ElementOptions.ts +7 -7
- package/src/Interfaces/IReplacement.ts +2 -2
- package/src/Types/Able.ts +22 -0
- package/src/Types/Array.ts +7 -0
- package/src/Types/C#.ts +9 -0
- package/src/Types/Date.ts +1 -1
- package/src/Types/Events.ts +12 -12
- package/src/Types/Function.ts +10 -0
- package/src/Types/Object.ts +4 -0
- package/src/Types/PropertiesWith.ts +35 -4
- package/src/Types/String.ts +1 -0
- package/src/Types/TransformTypes.ts +23 -5
- package/src/Types/index.ts +7 -41
- package/src/Utils/ApiUtils/ApiTypes.ts +43 -0
- package/src/Utils/ApiUtils/RequestUtil.ts +87 -0
- package/src/Utils/ApiUtils/index.ts +39 -0
- package/src/Utils/ColorUtils.ts +102 -0
- package/src/Utils/FormUtils.ts +33 -0
- package/src/Utils/NumberUtils.ts +3 -0
- package/src/Utils/PatcherUtils.ts +111 -0
- package/src/Utils/StringUtils.ts +44 -0
- package/src/Utils/TimeUtils/debounce.util.ts +85 -0
- package/src/Utils/TimeUtils/functions.util.ts +18 -0
- package/src/Utils/TimeUtils/index.ts +9 -0
- package/src/Utils/TimeUtils/throttle.util.ts +44 -0
- package/src/Utils/index.ts +8 -0
- package/src/Extensions/Array.ts +0 -95
- package/src/Extensions/String.ts +0 -54
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
type UpdateFinder<T> = (item: T, index: number, self: Array<T>) => boolean;
|
|
1
|
+
export type UpdateFinder<T> = (item: T, index: number, self: Array<T>) => boolean;
|
|
3
2
|
declare global {
|
|
4
3
|
interface Array<T> {
|
|
5
4
|
/**
|
|
@@ -33,6 +32,21 @@ declare global {
|
|
|
33
32
|
* @param callback Function to execute
|
|
34
33
|
* @returns Array of results
|
|
35
34
|
*/
|
|
36
|
-
nth<U>(every: number, callback: (
|
|
35
|
+
nth<U>(every: number, callback: (item: T, index: number, collection: Array<T>, self: this) => U): Array<U>;
|
|
37
36
|
}
|
|
38
37
|
}
|
|
38
|
+
declare function add<T>(this: Array<T>, ...items: Array<T>): T[];
|
|
39
|
+
declare function update<T>(this: Array<T>, old: T | number | UpdateFinder<T>, updated: T): T;
|
|
40
|
+
declare function remove<T>(this: Array<T>, value: T | number): Array<T>;
|
|
41
|
+
declare function random<T>(this: Array<T>): T;
|
|
42
|
+
declare function index<T>(this: Array<T>, i: number): T;
|
|
43
|
+
declare function nth<T, U>(this: Array<T>, every: number, callback: (item: T, index: number, collection: Array<T>, self: Array<T>) => U): Array<U>;
|
|
44
|
+
export declare const ArrayExtensions: {
|
|
45
|
+
add: typeof add;
|
|
46
|
+
update: typeof update;
|
|
47
|
+
remove: typeof remove;
|
|
48
|
+
random: typeof random;
|
|
49
|
+
index: typeof index;
|
|
50
|
+
nth: typeof nth;
|
|
51
|
+
};
|
|
52
|
+
export {};
|
package/dist/Extensions/Array.js
CHANGED
|
@@ -49,15 +49,3 @@ exports.ArrayExtensions = {
|
|
|
49
49
|
add, update, remove,
|
|
50
50
|
random, index, nth
|
|
51
51
|
};
|
|
52
|
-
Array.prototype.nth = function (every, callback) {
|
|
53
|
-
const result = new Array();
|
|
54
|
-
let collection = new Array();
|
|
55
|
-
for (let i = 0; i < this.length; i++) {
|
|
56
|
-
collection.push(this[i]);
|
|
57
|
-
if (i % every === 0) {
|
|
58
|
-
result.push(callback(collection, i, this));
|
|
59
|
-
collection = new Array();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return result;
|
|
63
|
-
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Functionable } from "../Types";
|
|
1
2
|
declare global {
|
|
2
3
|
interface Function {
|
|
3
4
|
/**
|
|
@@ -5,10 +6,24 @@ declare global {
|
|
|
5
6
|
* @param obj Object to check
|
|
6
7
|
*/
|
|
7
8
|
is(obj: any): obj is Function;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves a Functionable<T> to T, if it's a function, it will be called with the provided arguments and its return value will be returned, otherwise the value itself will be returned.
|
|
11
|
+
* @param functionable The Functionable<T> to resolve
|
|
12
|
+
* @param args Arguments to call the function with if functionable is a function
|
|
13
|
+
*/
|
|
14
|
+
resolveFunctionable<T, TArgs extends any[] = any[]>(functionable: Functionable<T, TArgs>, ...args: TArgs): T;
|
|
15
|
+
/**
|
|
16
|
+
* Forces a Functionable<T> to be a function, if it's already a function, it will be returned as is, otherwise a function that returns the value will be returned.
|
|
17
|
+
* @param functionable The Functionable<T> to force to be a function
|
|
18
|
+
*/
|
|
19
|
+
forceFunction<T, TArgs extends any[] = any[]>(functionable: Functionable<T, TArgs>): (...args: TArgs) => T;
|
|
8
20
|
}
|
|
9
21
|
}
|
|
10
|
-
declare function is(obj: any): obj is Function;
|
|
22
|
+
export declare function is(obj: any): obj is Function;
|
|
23
|
+
export declare function resolveFunctionable<T, TArgs extends any[] = any[]>(functionable: Functionable<T, TArgs>, ...args: TArgs): T;
|
|
24
|
+
export declare function forceFunction<T, TArgs extends any[] = any[]>(functionable: Functionable<T, TArgs>): (...args: TArgs) => T;
|
|
11
25
|
export declare const FunctionExtensions: {
|
|
12
26
|
is: typeof is;
|
|
27
|
+
resolveFunctionable: typeof resolveFunctionable;
|
|
28
|
+
forceFunction: typeof forceFunction;
|
|
13
29
|
};
|
|
14
|
-
export {};
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FunctionExtensions = void 0;
|
|
3
|
+
exports.FunctionExtensions = exports.forceFunction = exports.resolveFunctionable = exports.is = void 0;
|
|
4
4
|
function is(obj) {
|
|
5
5
|
return typeof obj === 'function';
|
|
6
6
|
}
|
|
7
|
+
exports.is = is;
|
|
7
8
|
Function.is = is;
|
|
9
|
+
function resolveFunctionable(functionable, ...args) {
|
|
10
|
+
return is(functionable) ? functionable(...args) : functionable;
|
|
11
|
+
}
|
|
12
|
+
exports.resolveFunctionable = resolveFunctionable;
|
|
13
|
+
Function.resolveFunctionable = resolveFunctionable;
|
|
14
|
+
function forceFunction(functionable) {
|
|
15
|
+
return is(functionable) ? functionable : () => functionable;
|
|
16
|
+
}
|
|
17
|
+
exports.forceFunction = forceFunction;
|
|
18
|
+
Function.forceFunction = forceFunction;
|
|
8
19
|
exports.FunctionExtensions = {
|
|
9
|
-
is
|
|
20
|
+
is,
|
|
21
|
+
resolveFunctionable,
|
|
22
|
+
forceFunction
|
|
10
23
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type Separators = {
|
|
2
|
+
thousand: string;
|
|
3
|
+
decimal: string;
|
|
4
|
+
};
|
|
5
|
+
declare global {
|
|
6
|
+
interface Number {
|
|
7
|
+
toSeparationString(separators: Partial<Separators>): string;
|
|
8
|
+
toRomanNumeral(): string;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare function toSeparationString(this: number, separators: Partial<Separators>): string;
|
|
12
|
+
export declare function toRomanNumeral(this: number): string;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toRomanNumeral = exports.toSeparationString = void 0;
|
|
4
|
+
function toSeparationString(separators) {
|
|
5
|
+
const { thousand = '.', decimal = '.' } = separators;
|
|
6
|
+
const [integerPart, decimalPart] = this.toString().split('.');
|
|
7
|
+
const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, thousand);
|
|
8
|
+
return decimalPart ? `${formattedInteger}${decimal}${decimalPart}` : formattedInteger;
|
|
9
|
+
}
|
|
10
|
+
exports.toSeparationString = toSeparationString;
|
|
11
|
+
Number.prototype.toSeparationString = toSeparationString;
|
|
12
|
+
function toRomanNumeral() {
|
|
13
|
+
if (this <= 0 || this >= 4000)
|
|
14
|
+
throw new RangeError('Number must be between 1 and 3999 to convert to Roman numeral');
|
|
15
|
+
const numeralMap = [
|
|
16
|
+
[1000, 'M'],
|
|
17
|
+
[900, 'CM'],
|
|
18
|
+
[500, 'D'],
|
|
19
|
+
[400, 'CD'],
|
|
20
|
+
[100, 'C'],
|
|
21
|
+
[90, 'XC'],
|
|
22
|
+
[50, 'L'],
|
|
23
|
+
[40, 'XL'],
|
|
24
|
+
[10, 'X'],
|
|
25
|
+
[9, 'IX'],
|
|
26
|
+
[5, 'V'],
|
|
27
|
+
[4, 'IV'],
|
|
28
|
+
[1, 'I']
|
|
29
|
+
];
|
|
30
|
+
let value = this;
|
|
31
|
+
return numeralMap.reduce((acc, [numeralValue, numeral]) => {
|
|
32
|
+
while (value >= numeralValue) {
|
|
33
|
+
acc += numeral;
|
|
34
|
+
value -= numeralValue;
|
|
35
|
+
}
|
|
36
|
+
return acc;
|
|
37
|
+
}, '');
|
|
38
|
+
}
|
|
39
|
+
exports.toRomanNumeral = toRomanNumeral;
|
|
40
|
+
Number.prototype.toRomanNumeral = toRomanNumeral;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValueOf } from "../../Types";
|
|
2
|
+
declare global {
|
|
3
|
+
interface ObjectConstructor {
|
|
4
|
+
/**
|
|
5
|
+
* Destructures object into array of [property, value]
|
|
6
|
+
* @param from Object to destruct
|
|
7
|
+
*/
|
|
8
|
+
array<From extends {} = {}>(from: From): Array<[keyof From, ValueOf<From>]>;
|
|
9
|
+
/**
|
|
10
|
+
* Destructures object into array of property keys
|
|
11
|
+
* @param from Object to destruct
|
|
12
|
+
*/
|
|
13
|
+
keysOf<From extends {} = {}>(from: From): Array<keyof From>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export declare function array<From extends {} = {}>(this: object, from: From): Array<[keyof From, ValueOf<From>]>;
|
|
17
|
+
export declare function keysOf<From extends {} = {}>(this: object, from: From): Array<keyof From>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keysOf = exports.array = void 0;
|
|
4
|
+
function array(from) {
|
|
5
|
+
return Object.entries(from);
|
|
6
|
+
}
|
|
7
|
+
exports.array = array;
|
|
8
|
+
Object.array = array;
|
|
9
|
+
function keysOf(from) {
|
|
10
|
+
return Object.keys(from);
|
|
11
|
+
}
|
|
12
|
+
exports.keysOf = keysOf;
|
|
13
|
+
Object.keysOf = keysOf;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface ObjectConstructor {
|
|
3
|
+
/**
|
|
4
|
+
* Returns true if objects are equal by comparing their properties and values recursively. Does not compare functions.
|
|
5
|
+
* @param a First object
|
|
6
|
+
* @param b Second object
|
|
7
|
+
* @returns true if objects are equal, false otherwise
|
|
8
|
+
*/
|
|
9
|
+
areEqual<T extends object | null>(a?: T, b?: T): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Returns true if object is empty
|
|
12
|
+
* @param obj Object to check
|
|
13
|
+
*/
|
|
14
|
+
isNullOrUndefined(obj: any): obj is null | undefined;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export declare function areEqual<T extends object | null>(a?: T, b?: T): boolean;
|
|
18
|
+
export declare function isNullOrUndefined(obj: any): obj is null | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNullOrUndefined = exports.areEqual = void 0;
|
|
4
|
+
function areEqual(a, b) {
|
|
5
|
+
if (a === b)
|
|
6
|
+
return true;
|
|
7
|
+
if (typeof a !== typeof b)
|
|
8
|
+
return false;
|
|
9
|
+
if (isNullOrUndefined(a) && isNullOrUndefined(b))
|
|
10
|
+
return true;
|
|
11
|
+
const keysA = Object.keys(a ?? {});
|
|
12
|
+
const keysB = Object.keys(b ?? {});
|
|
13
|
+
if (keysA.length !== keysB.length)
|
|
14
|
+
return false;
|
|
15
|
+
try {
|
|
16
|
+
const jsonA = JSON.stringify(a);
|
|
17
|
+
const jsonB = JSON.stringify(b);
|
|
18
|
+
if (jsonA === jsonB)
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
for (const key of keysA) {
|
|
23
|
+
if (!keysB.includes(key))
|
|
24
|
+
return false;
|
|
25
|
+
if (!areEqual(a[key], b[key]))
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
exports.areEqual = areEqual;
|
|
32
|
+
Object.areEqual = areEqual;
|
|
33
|
+
function isNullOrUndefined(obj) {
|
|
34
|
+
return obj === null || obj === undefined;
|
|
35
|
+
}
|
|
36
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
|
37
|
+
Object.isNullOrUndefined = isNullOrUndefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface ObjectConstructor {
|
|
3
|
+
/**
|
|
4
|
+
* Get a copy of object without specified properties or partial versions.
|
|
5
|
+
* @param from Object to extract properties from
|
|
6
|
+
* @param props Properties to extract/Omit
|
|
7
|
+
*/
|
|
8
|
+
omit<From extends {}, Props extends keyof From>(from: From, ...props: Array<Props | Partial<From>>): Omit<From, Props>;
|
|
9
|
+
/**
|
|
10
|
+
* Get a copy of object with only specified properties or partial versions.
|
|
11
|
+
* @param from Object to extract properties from
|
|
12
|
+
* @param props Properties to extract/Pick
|
|
13
|
+
*/
|
|
14
|
+
pick<From extends {}, Props extends keyof From>(from: From, ...props: Array<Props | Partial<From>>): Pick<From, Props>;
|
|
15
|
+
/**
|
|
16
|
+
* Receive an object with properties that are not in union of source and target objects
|
|
17
|
+
* @param source Source object
|
|
18
|
+
* @param target Target object
|
|
19
|
+
* @param exclude Properties to exclude from difference
|
|
20
|
+
* @returns Object with properties that are not in union of source and target objects, excluding specified properties
|
|
21
|
+
*/
|
|
22
|
+
difference<T extends object>(source: T, target: T, ...exclude: Array<keyof T>): Omit<T, keyof T>;
|
|
23
|
+
/**
|
|
24
|
+
* Deeply combines objects, with later objects in parameters taking precedence over earlier ones. Does not combine arrays.
|
|
25
|
+
* @param objects Objects to combine
|
|
26
|
+
* @returns Combined object
|
|
27
|
+
*/
|
|
28
|
+
combine<T extends Record<string, any | undefined>>(...objects: Array<Partial<T> | undefined>): T;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export declare function omit<From extends {}, Props extends keyof From>(from: From, ...props: Array<Props | Partial<From>>): Omit<From, Props>;
|
|
32
|
+
export declare function pick<From extends {}, Props extends keyof From>(from: From, ...props: Array<Props | Partial<From>>): Pick<From, Props>;
|
|
33
|
+
export declare function difference<T extends object>(source: T, target: T, ...exclude: Array<keyof T>): Omit<T, keyof T>;
|
|
34
|
+
type Combinable<T extends Record<string, any>> = {
|
|
35
|
+
[key in keyof T]?: T[key] extends Record<string, any> ? Combinable<T[key]> : T[key];
|
|
36
|
+
};
|
|
37
|
+
export declare function combine<T extends Record<string, any | undefined>>(...objects: Array<Combinable<T> | undefined>): T;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.combine = exports.difference = exports.pick = exports.omit = void 0;
|
|
4
|
+
function omit(from, ...props) {
|
|
5
|
+
return props.reduce((result, prop) => {
|
|
6
|
+
if (typeof prop === "object") {
|
|
7
|
+
const keys = Object.keysOf(prop);
|
|
8
|
+
keys.forEach(key => delete result[key]);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
delete result[prop];
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}, { ...from });
|
|
15
|
+
}
|
|
16
|
+
exports.omit = omit;
|
|
17
|
+
Object.omit = omit;
|
|
18
|
+
function pick(from, ...props) {
|
|
19
|
+
return props.reduce((result, prop) => {
|
|
20
|
+
if (typeof prop === "object") {
|
|
21
|
+
const keys = Object.keysOf(prop);
|
|
22
|
+
keys.forEach(key => result[key] = from[key]);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
result[prop] = from[prop];
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}, {});
|
|
29
|
+
}
|
|
30
|
+
exports.pick = pick;
|
|
31
|
+
Object.pick = pick;
|
|
32
|
+
function difference(source, target, ...exclude) {
|
|
33
|
+
const diffKeys = new Set([...Object.keysOf(source), ...Object.keysOf(target)]);
|
|
34
|
+
exclude?.forEach(key => diffKeys.delete(key));
|
|
35
|
+
return [...diffKeys.values()].reduce((acc, key, i, arr) => {
|
|
36
|
+
const sourceValue = JSON.stringify(source[key]);
|
|
37
|
+
const targetValue = JSON.stringify(target[key]);
|
|
38
|
+
if (sourceValue !== targetValue)
|
|
39
|
+
acc[key] = target[key];
|
|
40
|
+
return acc;
|
|
41
|
+
}, {});
|
|
42
|
+
}
|
|
43
|
+
exports.difference = difference;
|
|
44
|
+
Object.difference = difference;
|
|
45
|
+
function combine(...objects) {
|
|
46
|
+
return objects.reduce((acc, obj) => {
|
|
47
|
+
if (!obj)
|
|
48
|
+
return acc;
|
|
49
|
+
for (const key in obj) {
|
|
50
|
+
if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
|
|
51
|
+
try {
|
|
52
|
+
acc[key] = combine(acc[key], obj[key]);
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
const error = err;
|
|
56
|
+
if (error.message.includes('Maximum call stack size exceeded')) {
|
|
57
|
+
acc[key] = obj[key];
|
|
58
|
+
}
|
|
59
|
+
else
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (obj[key] !== undefined && obj[key] !== null && obj[key] !== '') {
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
acc[key] = obj[key];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return acc;
|
|
69
|
+
}, {});
|
|
70
|
+
}
|
|
71
|
+
exports.combine = combine;
|
|
72
|
+
Object.combine = combine;
|
|
@@ -1,49 +1,10 @@
|
|
|
1
|
-
import { ValueOf } from "../../Types";
|
|
2
|
-
import { Properties } from "./properties";
|
|
3
|
-
declare global {
|
|
4
|
-
interface ObjectConstructor {
|
|
5
|
-
/**
|
|
6
|
-
* Destructures object into array of [property, value]
|
|
7
|
-
* @param from Object to destruct
|
|
8
|
-
*/
|
|
9
|
-
array<From extends {} = {}>(from: From): Array<[keyof From, ValueOf<From>]>;
|
|
10
|
-
/**
|
|
11
|
-
* Omits properties from object, but for some reason the correct term is "extract"
|
|
12
|
-
* @param from Object to extract properties from
|
|
13
|
-
* @param props Properties to extract/Omit
|
|
14
|
-
*/
|
|
15
|
-
extract<From extends {}, Props extends keyof From>(from: From, ...props: Array<Props | Partial<From>>): Omit<From, Props>;
|
|
16
|
-
/**
|
|
17
|
-
* Pick properties from object, but for some reason the correct term is "exclude"
|
|
18
|
-
* @param from Object to exclude properties from
|
|
19
|
-
* @param props Properties to exclude/pick
|
|
20
|
-
*/
|
|
21
|
-
exclude<From extends {}, Props extends keyof From>(from: From, ...props: Array<Props | Partial<From>>): Pick<From, Props>;
|
|
22
|
-
/**
|
|
23
|
-
* Returns true if object is empty
|
|
24
|
-
* @param obj Object to check
|
|
25
|
-
*/
|
|
26
|
-
isNullOrUndefined(obj: any): obj is null | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Destructures object into array of property keys
|
|
29
|
-
* @param from Object to destruct
|
|
30
|
-
*/
|
|
31
|
-
keysOf<From extends {} = {}>(from: From): Array<keyof From>;
|
|
32
|
-
omit<From extends {}, Exclude extends keyof From>(from: From, ...exclude: Exclude[]): Omit<From, Exclude>;
|
|
33
|
-
properties: Properties;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
declare function array<From extends {} = {}>(this: object, from: From): Array<[keyof From, ValueOf<From>]>;
|
|
37
|
-
declare function extract<From extends {}, Props extends keyof From>(from: From, ...props: Array<Props | Partial<From>>): Omit<From, Props>;
|
|
38
|
-
declare function exclude<From extends {}, Props extends keyof From>(from: From, ...props: Array<Props | Partial<From>>): Pick<From, Props>;
|
|
39
|
-
declare function isNullOrUndefined(obj: any): obj is null | undefined;
|
|
40
|
-
declare function keysOf<From extends {} = {}>(this: object, from: From): Array<keyof From>;
|
|
41
1
|
export declare const ObjectExtensions: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
2
|
+
omit<From extends {}, Props extends keyof From>(from: From, ...props: (Props | Partial<From>)[]): Omit<From, Props>;
|
|
3
|
+
pick<From_1 extends {}, Props_1 extends keyof From_1>(from: From_1, ...props: (Props_1 | Partial<From_1>)[]): Pick<From_1, Props_1>;
|
|
4
|
+
difference<T extends object>(source: T, target: T, ...exclude: (keyof T)[]): Omit<T, keyof T>;
|
|
5
|
+
combine<T_1 extends Record<string, any>>(...objects: ({ [key in keyof T_1]?: (T_1[key] extends Record<string, any> ? T_1[key] extends infer T_2 extends Record<string, any> ? { [key_1 in keyof T_2]?: (T_1[key][key_1] extends Record<string, any> ? T_1[key][key_1] extends infer T_3 extends Record<string, any> ? { [key_2 in keyof T_3]?: (T_1[key][key_1][key_2] extends Record<string, any> ? T_1[key][key_1][key_2] extends infer T_4 extends Record<string, any> ? { [key_3 in keyof T_4]?: (T_1[key][key_1][key_2][key_3] extends Record<string, any> ? T_1[key][key_1][key_2][key_3] extends infer T_5 extends Record<string, any> ? { [key_4 in keyof T_5]?: (T_1[key][key_1][key_2][key_3][key_4] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4] extends infer T_6 extends Record<string, any> ? { [key_5 in keyof T_6]?: (T_1[key][key_1][key_2][key_3][key_4][key_5] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4][key_5] extends infer T_7 extends Record<string, any> ? { [key_6 in keyof T_7]?: (T_1[key][key_1][key_2][key_3][key_4][key_5][key_6] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4][key_5][key_6] extends infer T_8 extends Record<string, any> ? { [key_7 in keyof T_8]?: (T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7] extends infer T_9 extends Record<string, any> ? { [key_8 in keyof T_9]?: (T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8] extends infer T_10 extends Record<string, any> ? { [key_9 in keyof T_10]?: (T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8][key_9] extends Record<string, any> ? T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8][key_9] extends infer T_11 extends Record<string, any> ? { [key_10 in keyof T_11]?: (T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8][key_9][key_10] extends Record<string, any> ? any : T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8][key_9][key_10]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8][key_9]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7][key_8]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4][key_5][key_6][key_7]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4][key_5][key_6]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4][key_5]) | undefined; } : never : T_1[key][key_1][key_2][key_3][key_4]) | undefined; } : never : T_1[key][key_1][key_2][key_3]) | undefined; } : never : T_1[key][key_1][key_2]) | undefined; } : never : T_1[key][key_1]) | undefined; } : never : T_1[key]) | undefined; } | undefined)[]): T_1;
|
|
6
|
+
areEqual<T_12 extends object | null>(a?: T_12 | undefined, b?: T_12 | undefined): boolean;
|
|
7
|
+
isNullOrUndefined(obj: any): obj is null | undefined;
|
|
8
|
+
array<From_2 extends {} = {}>(this: object, from: From_2): [keyof From_2, import("../..").ValueOf<From_2>][];
|
|
9
|
+
keysOf<From_3 extends {} = {}>(this: object, from: From_3): (keyof From_3)[];
|
|
48
10
|
};
|
|
49
|
-
export {};
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.ObjectExtensions = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.array = array;
|
|
9
|
-
function extract(from, ...props) {
|
|
10
|
-
// If props are Array<keyof From>, Array<Partial<From>>, or Array<keyof From | Partial<From>>, ensure _props as Array<keyof From>
|
|
11
|
-
const _props = props.map(prop => typeof prop === "object" ? Object.keysOf(prop) : prop).flat();
|
|
12
|
-
_props.forEach(prop => delete from[prop]);
|
|
13
|
-
return from;
|
|
14
|
-
}
|
|
15
|
-
Object.extract = extract;
|
|
16
|
-
function exclude(from, ...props) {
|
|
17
|
-
// If props are Array<keyof From>, Array<Partial<From>>, or Array<keyof From | Partial<From>>, ensure _props as Array<keyof From>
|
|
18
|
-
const _props = props.map(prop => typeof prop === "object" ? Object.keysOf(prop) : prop).flat();
|
|
19
|
-
return Object.keysOf(from).reduce((result, prop) => {
|
|
20
|
-
if (_props.includes(prop))
|
|
21
|
-
delete result[prop];
|
|
22
|
-
return result;
|
|
23
|
-
}, from);
|
|
24
|
-
}
|
|
25
|
-
Object.exclude = exclude;
|
|
26
|
-
function isNullOrUndefined(obj) {
|
|
27
|
-
return obj === null || obj === undefined;
|
|
28
|
-
}
|
|
29
|
-
Object.isNullOrUndefined = isNullOrUndefined;
|
|
30
|
-
function keysOf(from) {
|
|
31
|
-
return Object.keys(from);
|
|
32
|
-
}
|
|
33
|
-
Object.keysOf = keysOf;
|
|
34
|
-
Object.properties = properties_1.properties;
|
|
27
|
+
const Array = __importStar(require("./arrays.extension"));
|
|
28
|
+
const Booleans = __importStar(require("./booleans.extension"));
|
|
29
|
+
const Extracts = __importStar(require("./extracts.extension"));
|
|
30
|
+
const Properties = __importStar(require("./properties.extension"));
|
|
35
31
|
exports.ObjectExtensions = {
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
...Array,
|
|
33
|
+
...Booleans,
|
|
34
|
+
...Extracts,
|
|
35
|
+
...Properties
|
|
38
36
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.properties = void 0;
|
|
4
|
-
const String_1 = require("../String");
|
|
5
4
|
exports.properties = [
|
|
6
5
|
'string', 'number', 'boolean', 'undefined', 'null',
|
|
7
6
|
'object', 'function', 'any',
|
|
8
7
|
'Date', 'RegExp', 'Promise', 'Array', 'Map', 'Set'
|
|
9
8
|
].reduce((result, primitive) => {
|
|
10
|
-
result[`get${
|
|
9
|
+
result[`get${primitive.convertCase('camel', 'pascal')}s`] = function (source, withFunctions = false) {
|
|
11
10
|
return Object.keysOf(source).reduce((result, key) => {
|
|
12
11
|
if (source[key].constructor.name === primitive ||
|
|
13
12
|
(withFunctions && typeof source[key] === 'function' && source[key]).constructor.name === primitive) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Case = 'camel' | 'pascal' | 'snake' | 'kebab' | 'lower' | 'upper';
|
|
2
|
+
declare global {
|
|
3
|
+
interface String {
|
|
4
|
+
/**
|
|
5
|
+
* Converts string from one case to another.
|
|
6
|
+
* @param from Case to convert from
|
|
7
|
+
* @param to Cases to convert to, in order. If multiple cases are provided, they will be applied in order
|
|
8
|
+
*/
|
|
9
|
+
convertCase<To extends Array<Case>, Return extends To extends [...Array<Case>, infer To] ? To : Case>(from: Case, ...to: To): (Return extends 'upper' ? Uppercase<string> : Return extends 'lower' ? Lowercase<string> : Return extends 'pascal' ? Capitalize<string> : Return extends 'camel' ? Uncapitalize<string> : string);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const convertCase: <TValue extends string, To extends Case[], Return extends To extends [...Case[], infer To_1] ? To_1 : Case>(value: TValue, from: Case, ...to: To) => Return extends "upper" ? Uppercase<TValue> : Return extends "lower" ? Lowercase<TValue> : Return extends "pascal" ? Capitalize<TValue> : Return extends "camel" ? Uncapitalize<TValue> : string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertCase = void 0;
|
|
4
|
+
const caseMap = {
|
|
5
|
+
camel: {
|
|
6
|
+
camel: (str) => str,
|
|
7
|
+
lower: (str) => str.toLowerCase(),
|
|
8
|
+
upper: (str) => str.toUpperCase(),
|
|
9
|
+
pascal: (str) => str[0].toUpperCase() + str.replace(/([A-Z])/g, (match) => ` ${match}`).slice(1),
|
|
10
|
+
snake: (str) => str.replace(/([A-Z])/g, (match) => `_${match.toLowerCase()}`),
|
|
11
|
+
kebab: (str) => str.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`),
|
|
12
|
+
},
|
|
13
|
+
pascal: {
|
|
14
|
+
pascal: (str) => str,
|
|
15
|
+
lower: (str) => str.toLowerCase(),
|
|
16
|
+
upper: (str) => str.toUpperCase(),
|
|
17
|
+
camel: (str) => str[0].toLowerCase() + str.slice(1),
|
|
18
|
+
snake: (str) => str.replace(/([A-Z])/g, (match) => `_${match.toLowerCase()}`),
|
|
19
|
+
kebab: (str) => str.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`),
|
|
20
|
+
},
|
|
21
|
+
snake: {
|
|
22
|
+
snake: (str) => str,
|
|
23
|
+
lower: (str) => str.toLowerCase(),
|
|
24
|
+
upper: (str) => str.toUpperCase(),
|
|
25
|
+
camel: (str) => str.replace(/(_\w)/g, (match) => match[1].toUpperCase()),
|
|
26
|
+
pascal: (str) => str[0].toUpperCase() + str.substring(1, str.length).replace(/(_\w)/g, (match) => match[1].toUpperCase()),
|
|
27
|
+
kebab: (str) => str.replace(/_/g, '-'),
|
|
28
|
+
},
|
|
29
|
+
kebab: {
|
|
30
|
+
kebab: (str) => str,
|
|
31
|
+
lower: (str) => str.toLowerCase(),
|
|
32
|
+
upper: (str) => str.toUpperCase(),
|
|
33
|
+
camel: (str) => str.replace(/(-\w)/g, (match) => match[1].toUpperCase()),
|
|
34
|
+
pascal: (str) => str[0].toUpperCase() + str.substring(1, str.length).replace(/(-\w)/g, (match) => match[1].toUpperCase()),
|
|
35
|
+
snake: (str) => str.replace(/-/g, '_'),
|
|
36
|
+
},
|
|
37
|
+
lower: {
|
|
38
|
+
lower: (str) => str.toLowerCase(),
|
|
39
|
+
upper: (str) => str.toUpperCase(),
|
|
40
|
+
camel: (str) => str,
|
|
41
|
+
pascal: (str) => str[0].toUpperCase() + str.slice(1),
|
|
42
|
+
snake: (str) => str,
|
|
43
|
+
kebab: (str) => str,
|
|
44
|
+
},
|
|
45
|
+
upper: {
|
|
46
|
+
upper: (str) => str.toUpperCase(),
|
|
47
|
+
camel: (str) => str[0].toLowerCase() + str.slice(1),
|
|
48
|
+
pascal: (str) => str[0].toUpperCase() + str.toLowerCase().slice(1),
|
|
49
|
+
snake: (str) => str.replace(/ /g, '_'),
|
|
50
|
+
kebab: (str) => str.replace(/ /g, '-'),
|
|
51
|
+
lower: (str) => str.toLowerCase(),
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const convertCase = (value, from, ...to) => to.reduce((str, toCase) => caseMap[from][toCase](str), value);
|
|
55
|
+
exports.convertCase = convertCase;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as Case from './case.extension';
|
|
2
|
+
export declare const StringUtils: {
|
|
3
|
+
convertCase: <TValue extends string, To extends Case.Case[], Return extends To extends [...Case.Case[], infer To_1] ? To_1 : Case.Case>(value: TValue, from: Case.Case, ...to: To) => Return extends "upper" ? Uppercase<TValue> : Return extends "lower" ? Lowercase<TValue> : Return extends "pascal" ? Capitalize<TValue> : Return extends "camel" ? Uncapitalize<TValue> : string;
|
|
4
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.StringUtils = void 0;
|
|
27
|
+
const Case = __importStar(require("./case.extension"));
|
|
28
|
+
exports.StringUtils = {
|
|
29
|
+
...Case,
|
|
30
|
+
};
|
|
@@ -2,16 +2,5 @@ export * from './Array';
|
|
|
2
2
|
export * from './Document';
|
|
3
3
|
export * from './Map';
|
|
4
4
|
export * from './Object';
|
|
5
|
+
export * from './Number';
|
|
5
6
|
export * from './String';
|
|
6
|
-
declare global {
|
|
7
|
-
interface BooleanConstructor {
|
|
8
|
-
/**
|
|
9
|
-
* Parses string to boolean. Will only return true if value === "true" otherwise false
|
|
10
|
-
*/
|
|
11
|
-
parseBoolean(value: string): boolean;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
declare function parseBoolean(value: string): boolean;
|
|
15
|
-
export declare const BooleanExtensions: {
|
|
16
|
-
parseBoolean: typeof parseBoolean;
|
|
17
|
-
};
|