danholibraryjs 1.11.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/Event.d.ts +66 -66
- package/dist/Classes/Events/Event.js +114 -114
- package/dist/Classes/Events/EventCollection.d.ts +57 -57
- package/dist/Classes/Events/EventCollection.js +109 -109
- package/dist/Classes/Events/EventEmitter.d.ts +74 -74
- package/dist/Classes/Events/EventEmitter.js +97 -97
- package/dist/Classes/Events/index.d.ts +3 -3
- package/dist/Classes/Events/index.js +19 -19
- package/dist/Classes/Time/Date.d.ts +148 -147
- package/dist/Classes/Time/Date.js +241 -238
- package/dist/Classes/Time/Time.d.ts +66 -65
- package/dist/Classes/Time/Time.js +120 -117
- package/dist/Classes/Time/TimeProperties.d.ts +3 -3
- package/dist/Classes/Time/TimeProperties.js +2 -2
- package/dist/Classes/Time/TimeSpan.d.ts +123 -123
- package/dist/Classes/Time/TimeSpan.js +179 -179
- package/dist/Classes/Time/index.d.ts +4 -4
- package/dist/Classes/Time/index.js +20 -20
- package/dist/Classes/index.d.ts +4 -3
- package/dist/Classes/index.js +20 -19
- package/dist/Classes/store.d.ts +75 -75
- package/dist/Classes/store.js +84 -84
- 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 +52 -52
- package/dist/Extensions/Array.js +51 -51
- package/dist/Extensions/Document.d.ts +27 -27
- package/dist/Extensions/Document.js +32 -32
- package/dist/Extensions/Function.d.ts +29 -14
- package/dist/Extensions/Function.js +23 -10
- package/dist/Extensions/Map.d.ts +54 -54
- package/dist/Extensions/Map.js +42 -42
- 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 +10 -49
- package/dist/Extensions/Object/index.js +36 -38
- package/dist/Extensions/Object/properties.d.ts +28 -28
- 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 +19 -20
- 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/String.d.ts +36 -36
- package/dist/Extensions/String.js +25 -25
- package/dist/Extensions/index.d.ts +6 -17
- package/dist/Extensions/index.js +22 -30
- package/dist/Functions/CopyToClipboard.d.ts +7 -7
- package/dist/Functions/CopyToClipboard.js +15 -15
- package/dist/Functions/GetCSSProperty.d.ts +15 -15
- package/dist/Functions/GetCSSProperty.js +26 -26
- package/dist/Functions/GetNestedProperty.d.ts +9 -9
- package/dist/Functions/GetNestedProperty.js +23 -23
- package/dist/Functions/HTMLEvent.d.ts +11 -11
- package/dist/Functions/HTMLEvent.js +14 -14
- package/dist/Functions/SetNavigationSelected.d.ts +9 -9
- package/dist/Functions/SetNavigationSelected.js +25 -25
- package/dist/Functions/index.d.ts +5 -5
- package/dist/Functions/index.js +21 -21
- package/dist/Interfaces/ElementOptions.d.ts +15 -15
- package/dist/Interfaces/ElementOptions.js +2 -2
- package/dist/Interfaces/IReplacement.d.ts +12 -12
- package/dist/Interfaces/IReplacement.js +2 -2
- package/dist/Interfaces/index.d.ts +2 -2
- package/dist/Interfaces/index.js +18 -18
- 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/BetterTypes.d.ts +9 -9
- package/dist/Types/BetterTypes.js +2 -2
- package/dist/Types/C#.d.ts +8 -0
- package/dist/Types/C#.js +2 -0
- package/dist/Types/Date.d.ts +6 -6
- package/dist/Types/Date.js +2 -2
- package/dist/Types/Events.d.ts +10 -10
- package/dist/Types/Events.js +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 +34 -13
- package/dist/Types/PropertiesWith.js +2 -2
- package/dist/Types/String.d.ts +1 -0
- package/dist/Types/String.js +2 -0
- package/dist/Types/TransformTypes.d.ts +22 -16
- package/dist/Types/TransformTypes.js +2 -2
- package/dist/Types/index.d.ts +24 -65
- package/dist/Types/index.js +27 -21
- package/dist/Utils/ApiUtil/ApiTypes.d.ts +15 -15
- package/dist/Utils/ApiUtil/ApiTypes.js +15 -15
- package/dist/Utils/ApiUtil/RequestUtil.d.ts +19 -19
- package/dist/Utils/ApiUtil/RequestUtil.js +73 -73
- package/dist/Utils/ApiUtil/index.d.ts +20 -20
- package/dist/Utils/ApiUtil/index.js +33 -33
- 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 -6
- package/dist/Utils/FormUtil.js +35 -35
- 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 -2
- package/dist/Utils/index.js +23 -18
- package/dist/index.d.ts +5 -5
- package/dist/index.js +21 -21
- 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 +21 -13
- package/src/Types/index.ts +7 -69
- package/src/Utils/{ApiUtil → ApiUtils}/ApiTypes.ts +2 -1
- package/src/Utils/{ApiUtil → ApiUtils}/index.ts +1 -1
- package/src/Utils/ColorUtils.ts +102 -0
- package/src/Utils/{FormUtil.ts → FormUtils.ts} +2 -2
- 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 -2
- package/src/Extensions/Array.ts +0 -95
- package/src/Extensions/String.ts +0 -54
- /package/src/Utils/{ApiUtil → ApiUtils}/RequestUtil.ts +0 -0
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StringExtensions = void 0;
|
|
4
|
-
function toPascalCase() {
|
|
5
|
-
return this.substring(0, 1).toUpperCase() + this.substring(1);
|
|
6
|
-
}
|
|
7
|
-
String.prototype.toPascalCase = toPascalCase;
|
|
8
|
-
function spaceReplacer(self, replacer, replacement) {
|
|
9
|
-
return self.replace(new RegExp(`${typeof replacer == 'string' ? replacer : replacer.source}+`), replacement);
|
|
10
|
-
}
|
|
11
|
-
function toSnakeCase(replaceOptions) {
|
|
12
|
-
return spaceReplacer(this, replaceOptions.replacer || ' ', replaceOptions.replacement || '_');
|
|
13
|
-
}
|
|
14
|
-
String.prototype.toSnakeCase = toSnakeCase;
|
|
15
|
-
function toKebabCase(replaceOptions) {
|
|
16
|
-
return spaceReplacer(this, replaceOptions.replacer || ' ', replaceOptions.replacement || '-');
|
|
17
|
-
}
|
|
18
|
-
String.prototype.toKebabCase = toKebabCase;
|
|
19
|
-
function clip(start, end) {
|
|
20
|
-
return this.substring(start < 0 ? this.length - start : start, end && end < 0 ? this.length + end : end);
|
|
21
|
-
}
|
|
22
|
-
String.prototype.clip = clip;
|
|
23
|
-
exports.StringExtensions = {
|
|
24
|
-
toPascalCase, toSnakeCase, toKebabCase, clip
|
|
25
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringExtensions = void 0;
|
|
4
|
+
function toPascalCase() {
|
|
5
|
+
return this.substring(0, 1).toUpperCase() + this.substring(1);
|
|
6
|
+
}
|
|
7
|
+
String.prototype.toPascalCase = toPascalCase;
|
|
8
|
+
function spaceReplacer(self, replacer, replacement) {
|
|
9
|
+
return self.replace(new RegExp(`${typeof replacer == 'string' ? replacer : replacer.source}+`), replacement);
|
|
10
|
+
}
|
|
11
|
+
function toSnakeCase(replaceOptions) {
|
|
12
|
+
return spaceReplacer(this, replaceOptions.replacer || ' ', replaceOptions.replacement || '_');
|
|
13
|
+
}
|
|
14
|
+
String.prototype.toSnakeCase = toSnakeCase;
|
|
15
|
+
function toKebabCase(replaceOptions) {
|
|
16
|
+
return spaceReplacer(this, replaceOptions.replacer || ' ', replaceOptions.replacement || '-');
|
|
17
|
+
}
|
|
18
|
+
String.prototype.toKebabCase = toKebabCase;
|
|
19
|
+
function clip(start, end) {
|
|
20
|
+
return this.substring(start < 0 ? this.length - start : start, end && end < 0 ? this.length + end : end);
|
|
21
|
+
}
|
|
22
|
+
String.prototype.clip = clip;
|
|
23
|
+
exports.StringExtensions = {
|
|
24
|
+
toPascalCase, toSnakeCase, toKebabCase, clip
|
|
25
|
+
};
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
export * from './Array';
|
|
2
|
-
export * from './Document';
|
|
3
|
-
export * from './Map';
|
|
4
|
-
export * from './Object';
|
|
5
|
-
export * from './
|
|
6
|
-
|
|
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
|
-
};
|
|
1
|
+
export * from './Array';
|
|
2
|
+
export * from './Document';
|
|
3
|
+
export * from './Map';
|
|
4
|
+
export * from './Object';
|
|
5
|
+
export * from './Number';
|
|
6
|
+
export * from './String';
|
package/dist/Extensions/index.js
CHANGED
|
@@ -1,30 +1,22 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
__exportStar(require("./String"), exports);
|
|
23
|
-
function parseBoolean(value) {
|
|
24
|
-
return value === "true";
|
|
25
|
-
}
|
|
26
|
-
;
|
|
27
|
-
Boolean.parseBoolean = parseBoolean;
|
|
28
|
-
exports.BooleanExtensions = {
|
|
29
|
-
parseBoolean
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Array"), exports);
|
|
18
|
+
__exportStar(require("./Document"), exports);
|
|
19
|
+
__exportStar(require("./Map"), exports);
|
|
20
|
+
__exportStar(require("./Object"), exports);
|
|
21
|
+
__exportStar(require("./Number"), exports);
|
|
22
|
+
__exportStar(require("./String"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copies value to clipboard and alerts a response, if response is defined
|
|
3
|
-
* @param value Value to clipboard
|
|
4
|
-
* @param response Alerts if response is given
|
|
5
|
-
*/
|
|
6
|
-
export declare function CopyToClipboard(value: string, response?: string): Promise<void>;
|
|
7
|
-
export default CopyToClipboard;
|
|
1
|
+
/**
|
|
2
|
+
* Copies value to clipboard and alerts a response, if response is defined
|
|
3
|
+
* @param value Value to clipboard
|
|
4
|
+
* @param response Alerts if response is given
|
|
5
|
+
*/
|
|
6
|
+
export declare function CopyToClipboard(value: string, response?: string): Promise<void>;
|
|
7
|
+
export default CopyToClipboard;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CopyToClipboard = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Copies value to clipboard and alerts a response, if response is defined
|
|
6
|
-
* @param value Value to clipboard
|
|
7
|
-
* @param response Alerts if response is given
|
|
8
|
-
*/
|
|
9
|
-
async function CopyToClipboard(value, response) {
|
|
10
|
-
await navigator.clipboard.writeText(value);
|
|
11
|
-
if (response)
|
|
12
|
-
alert(response);
|
|
13
|
-
}
|
|
14
|
-
exports.CopyToClipboard = CopyToClipboard;
|
|
15
|
-
exports.default = CopyToClipboard;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CopyToClipboard = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copies value to clipboard and alerts a response, if response is defined
|
|
6
|
+
* @param value Value to clipboard
|
|
7
|
+
* @param response Alerts if response is given
|
|
8
|
+
*/
|
|
9
|
+
async function CopyToClipboard(value, response) {
|
|
10
|
+
await navigator.clipboard.writeText(value);
|
|
11
|
+
if (response)
|
|
12
|
+
alert(response);
|
|
13
|
+
}
|
|
14
|
+
exports.CopyToClipboard = CopyToClipboard;
|
|
15
|
+
exports.default = CopyToClipboard;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
type CSSReturnTypes = {
|
|
2
|
-
string: string;
|
|
3
|
-
number: number;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Gets the value of "property" in type "type" from query "query"
|
|
7
|
-
* Basically, you can get your --color-primary from :root
|
|
8
|
-
*
|
|
9
|
-
* @param property Name of the property to get
|
|
10
|
-
* @param type Type of the property to parse
|
|
11
|
-
* @param query Query to get the element that has the property
|
|
12
|
-
* @returns Property value converted to type
|
|
13
|
-
*/
|
|
14
|
-
export declare function GetCSSProperty<Type extends keyof CSSReturnTypes>(property: string, type: Type, query?: string): CSSReturnTypes[Type];
|
|
15
|
-
export {};
|
|
1
|
+
type CSSReturnTypes = {
|
|
2
|
+
string: string;
|
|
3
|
+
number: number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Gets the value of "property" in type "type" from query "query"
|
|
7
|
+
* Basically, you can get your --color-primary from :root
|
|
8
|
+
*
|
|
9
|
+
* @param property Name of the property to get
|
|
10
|
+
* @param type Type of the property to parse
|
|
11
|
+
* @param query Query to get the element that has the property
|
|
12
|
+
* @returns Property value converted to type
|
|
13
|
+
*/
|
|
14
|
+
export declare function GetCSSProperty<Type extends keyof CSSReturnTypes>(property: string, type: Type, query?: string): CSSReturnTypes[Type];
|
|
15
|
+
export {};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetCSSProperty = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Gets the value of "property" in type "type" from query "query"
|
|
6
|
-
* Basically, you can get your --color-primary from :root
|
|
7
|
-
*
|
|
8
|
-
* @param property Name of the property to get
|
|
9
|
-
* @param type Type of the property to parse
|
|
10
|
-
* @param query Query to get the element that has the property
|
|
11
|
-
* @returns Property value converted to type
|
|
12
|
-
*/
|
|
13
|
-
function GetCSSProperty(property, type, query = ":root") {
|
|
14
|
-
const rootEl = document.querySelector(query);
|
|
15
|
-
if (!rootEl)
|
|
16
|
-
throw new Error(`${query} does not exist!`);
|
|
17
|
-
const rootStyles = getComputedStyle(rootEl);
|
|
18
|
-
const cssProp = rootStyles.getPropertyValue(property);
|
|
19
|
-
if (type === 'string')
|
|
20
|
-
return cssProp;
|
|
21
|
-
const numberValue = parseInt(cssProp);
|
|
22
|
-
if (isNaN(numberValue))
|
|
23
|
-
throw new Error(`${property} is not a number!: ${cssProp}`);
|
|
24
|
-
return numberValue;
|
|
25
|
-
}
|
|
26
|
-
exports.GetCSSProperty = GetCSSProperty;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetCSSProperty = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Gets the value of "property" in type "type" from query "query"
|
|
6
|
+
* Basically, you can get your --color-primary from :root
|
|
7
|
+
*
|
|
8
|
+
* @param property Name of the property to get
|
|
9
|
+
* @param type Type of the property to parse
|
|
10
|
+
* @param query Query to get the element that has the property
|
|
11
|
+
* @returns Property value converted to type
|
|
12
|
+
*/
|
|
13
|
+
function GetCSSProperty(property, type, query = ":root") {
|
|
14
|
+
const rootEl = document.querySelector(query);
|
|
15
|
+
if (!rootEl)
|
|
16
|
+
throw new Error(`${query} does not exist!`);
|
|
17
|
+
const rootStyles = getComputedStyle(rootEl);
|
|
18
|
+
const cssProp = rootStyles.getPropertyValue(property);
|
|
19
|
+
if (type === 'string')
|
|
20
|
+
return cssProp;
|
|
21
|
+
const numberValue = parseInt(cssProp);
|
|
22
|
+
if (isNaN(numberValue))
|
|
23
|
+
throw new Error(`${property} is not a number!: ${cssProp}`);
|
|
24
|
+
return numberValue;
|
|
25
|
+
}
|
|
26
|
+
exports.GetCSSProperty = GetCSSProperty;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export type GetNestedProperty<Parent, Key extends string> = Key extends keyof Parent ? Parent[Key] : Key extends `${infer K}.${infer Rest}` ? K extends keyof Parent ? GetNestedProperty<Parent[K], Rest> : never : never;
|
|
2
|
-
/**
|
|
3
|
-
* Gets a nested property from an object
|
|
4
|
-
* @param parent Parent object to search
|
|
5
|
-
* @param key Key to search for. Can be nested with dot notation
|
|
6
|
-
* @returns Value of key or null if not found
|
|
7
|
-
*/
|
|
8
|
-
export declare function GetNestedProperty<Parent extends object, Key extends string>(parent: Parent, key: Key): GetNestedProperty<Parent, Key> | null;
|
|
9
|
-
export default GetNestedProperty;
|
|
1
|
+
export type GetNestedProperty<Parent, Key extends string> = Key extends keyof Parent ? Parent[Key] : Key extends `${infer K}.${infer Rest}` ? K extends keyof Parent ? GetNestedProperty<Parent[K], Rest> : never : never;
|
|
2
|
+
/**
|
|
3
|
+
* Gets a nested property from an object
|
|
4
|
+
* @param parent Parent object to search
|
|
5
|
+
* @param key Key to search for. Can be nested with dot notation
|
|
6
|
+
* @returns Value of key or null if not found
|
|
7
|
+
*/
|
|
8
|
+
export declare function GetNestedProperty<Parent extends object, Key extends string>(parent: Parent, key: Key): GetNestedProperty<Parent, Key> | null;
|
|
9
|
+
export default GetNestedProperty;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetNestedProperty = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Gets a nested property from an object
|
|
6
|
-
* @param parent Parent object to search
|
|
7
|
-
* @param key Key to search for. Can be nested with dot notation
|
|
8
|
-
* @returns Value of key or null if not found
|
|
9
|
-
*/
|
|
10
|
-
function GetNestedProperty(parent, key) {
|
|
11
|
-
if (key in parent)
|
|
12
|
-
return parent[key];
|
|
13
|
-
for (const prop in parent) {
|
|
14
|
-
if (typeof parent[prop] === 'object') {
|
|
15
|
-
const result = GetNestedProperty(parent[prop], key);
|
|
16
|
-
if (result)
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
exports.GetNestedProperty = GetNestedProperty;
|
|
23
|
-
exports.default = GetNestedProperty;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetNestedProperty = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Gets a nested property from an object
|
|
6
|
+
* @param parent Parent object to search
|
|
7
|
+
* @param key Key to search for. Can be nested with dot notation
|
|
8
|
+
* @returns Value of key or null if not found
|
|
9
|
+
*/
|
|
10
|
+
function GetNestedProperty(parent, key) {
|
|
11
|
+
if (key in parent)
|
|
12
|
+
return parent[key];
|
|
13
|
+
for (const prop in parent) {
|
|
14
|
+
if (typeof parent[prop] === 'object') {
|
|
15
|
+
const result = GetNestedProperty(parent[prop], key);
|
|
16
|
+
if (result)
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
exports.GetNestedProperty = GetNestedProperty;
|
|
23
|
+
exports.default = GetNestedProperty;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create HTMLEvent object from function
|
|
3
|
-
* @param name Name of the event
|
|
4
|
-
* @param handler Handler for the event
|
|
5
|
-
* @returns Parameters as object
|
|
6
|
-
*/
|
|
7
|
-
export declare function HTMLEvent<Event extends keyof HTMLElementEventMap, ReturnType extends any>(name: Event, handler: (event: HTMLElementEventMap[Event]) => ReturnType): {
|
|
8
|
-
name: Event;
|
|
9
|
-
handler: (event: HTMLElementEventMap[Event]) => ReturnType;
|
|
10
|
-
};
|
|
11
|
-
export default HTMLEvent;
|
|
1
|
+
/**
|
|
2
|
+
* Create HTMLEvent object from function
|
|
3
|
+
* @param name Name of the event
|
|
4
|
+
* @param handler Handler for the event
|
|
5
|
+
* @returns Parameters as object
|
|
6
|
+
*/
|
|
7
|
+
export declare function HTMLEvent<Event extends keyof HTMLElementEventMap, ReturnType extends any>(name: Event, handler: (event: HTMLElementEventMap[Event]) => ReturnType): {
|
|
8
|
+
name: Event;
|
|
9
|
+
handler: (event: HTMLElementEventMap[Event]) => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
export default HTMLEvent;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HTMLEvent = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Create HTMLEvent object from function
|
|
6
|
-
* @param name Name of the event
|
|
7
|
-
* @param handler Handler for the event
|
|
8
|
-
* @returns Parameters as object
|
|
9
|
-
*/
|
|
10
|
-
function HTMLEvent(name, handler) {
|
|
11
|
-
return { name, handler };
|
|
12
|
-
}
|
|
13
|
-
exports.HTMLEvent = HTMLEvent;
|
|
14
|
-
exports.default = HTMLEvent;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HTMLEvent = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Create HTMLEvent object from function
|
|
6
|
+
* @param name Name of the event
|
|
7
|
+
* @param handler Handler for the event
|
|
8
|
+
* @returns Parameters as object
|
|
9
|
+
*/
|
|
10
|
+
function HTMLEvent(name, handler) {
|
|
11
|
+
return { name, handler };
|
|
12
|
+
}
|
|
13
|
+
exports.HTMLEvent = HTMLEvent;
|
|
14
|
+
exports.default = HTMLEvent;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Appends classes to header's "a" elements, when navigation to "a"'s page is selected
|
|
3
|
-
* @param query The query selector for Document.querySelector
|
|
4
|
-
* @param currentPageClasses Class(es) to append header's "a" elements
|
|
5
|
-
*
|
|
6
|
-
* @borrows Document.querySelector
|
|
7
|
-
*/
|
|
8
|
-
export declare function SetNavigationSelected(query: string, ...currentPageClasses: string[]): void;
|
|
9
|
-
export default SetNavigationSelected;
|
|
1
|
+
/**
|
|
2
|
+
* Appends classes to header's "a" elements, when navigation to "a"'s page is selected
|
|
3
|
+
* @param query The query selector for Document.querySelector
|
|
4
|
+
* @param currentPageClasses Class(es) to append header's "a" elements
|
|
5
|
+
*
|
|
6
|
+
* @borrows Document.querySelector
|
|
7
|
+
*/
|
|
8
|
+
export declare function SetNavigationSelected(query: string, ...currentPageClasses: string[]): void;
|
|
9
|
+
export default SetNavigationSelected;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetNavigationSelected = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Appends classes to header's "a" elements, when navigation to "a"'s page is selected
|
|
6
|
-
* @param query The query selector for Document.querySelector
|
|
7
|
-
* @param currentPageClasses Class(es) to append header's "a" elements
|
|
8
|
-
*
|
|
9
|
-
* @borrows Document.querySelector
|
|
10
|
-
*/
|
|
11
|
-
function SetNavigationSelected(query, ...currentPageClasses) {
|
|
12
|
-
const header = document.querySelector(query);
|
|
13
|
-
if (!header)
|
|
14
|
-
throw { message: `Couldn't find header from query, ${query}` };
|
|
15
|
-
const children = header.children.array().filter(c => c.tagName === 'a');
|
|
16
|
-
const currentPage = document.location.href;
|
|
17
|
-
children.forEach(gc => {
|
|
18
|
-
if (gc.href != currentPage)
|
|
19
|
-
gc.classList.remove(...currentPageClasses);
|
|
20
|
-
else
|
|
21
|
-
gc.classList.add(...currentPageClasses);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
exports.SetNavigationSelected = SetNavigationSelected;
|
|
25
|
-
exports.default = SetNavigationSelected;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetNavigationSelected = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Appends classes to header's "a" elements, when navigation to "a"'s page is selected
|
|
6
|
+
* @param query The query selector for Document.querySelector
|
|
7
|
+
* @param currentPageClasses Class(es) to append header's "a" elements
|
|
8
|
+
*
|
|
9
|
+
* @borrows Document.querySelector
|
|
10
|
+
*/
|
|
11
|
+
function SetNavigationSelected(query, ...currentPageClasses) {
|
|
12
|
+
const header = document.querySelector(query);
|
|
13
|
+
if (!header)
|
|
14
|
+
throw { message: `Couldn't find header from query, ${query}` };
|
|
15
|
+
const children = header.children.array().filter(c => c.tagName === 'a');
|
|
16
|
+
const currentPage = document.location.href;
|
|
17
|
+
children.forEach(gc => {
|
|
18
|
+
if (gc.href != currentPage)
|
|
19
|
+
gc.classList.remove(...currentPageClasses);
|
|
20
|
+
else
|
|
21
|
+
gc.classList.add(...currentPageClasses);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.SetNavigationSelected = SetNavigationSelected;
|
|
25
|
+
exports.default = SetNavigationSelected;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './CopyToClipboard';
|
|
2
|
-
export * from './GetCSSProperty';
|
|
3
|
-
export * from './GetNestedProperty';
|
|
4
|
-
export * from './SetNavigationSelected';
|
|
5
|
-
export * from './HTMLEvent';
|
|
1
|
+
export * from './CopyToClipboard';
|
|
2
|
+
export * from './GetCSSProperty';
|
|
3
|
+
export * from './GetNestedProperty';
|
|
4
|
+
export * from './SetNavigationSelected';
|
|
5
|
+
export * from './HTMLEvent';
|
package/dist/Functions/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./CopyToClipboard"), exports);
|
|
18
|
-
__exportStar(require("./GetCSSProperty"), exports);
|
|
19
|
-
__exportStar(require("./GetNestedProperty"), exports);
|
|
20
|
-
__exportStar(require("./SetNavigationSelected"), exports);
|
|
21
|
-
__exportStar(require("./HTMLEvent"), exports);
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./CopyToClipboard"), exports);
|
|
18
|
+
__exportStar(require("./GetCSSProperty"), exports);
|
|
19
|
+
__exportStar(require("./GetNestedProperty"), exports);
|
|
20
|
+
__exportStar(require("./SetNavigationSelected"), exports);
|
|
21
|
+
__exportStar(require("./HTMLEvent"), exports);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Arrayable, IElement } from "../Types";
|
|
2
|
-
type Events = Record<`on${Capitalize<keyof HTMLElementEventMap>}`, (event: Event) => void>;
|
|
3
|
-
/**
|
|
4
|
-
* Construction options when creating an HTML element using:
|
|
5
|
-
* @see Document.createElement
|
|
6
|
-
* @borwwos IElement
|
|
7
|
-
* @borrows Arrayable
|
|
8
|
-
*/
|
|
9
|
-
export type ElementOptions = Partial<Events & Record<string, any> & {
|
|
10
|
-
id: string;
|
|
11
|
-
className: Arrayable<string>;
|
|
12
|
-
children: Arrayable<IElement>;
|
|
13
|
-
dataset: Record<string, string>;
|
|
14
|
-
}>;
|
|
15
|
-
export default ElementOptions;
|
|
1
|
+
import { Arrayable, IElement } from "../Types";
|
|
2
|
+
type Events = Record<`on${Capitalize<keyof HTMLElementEventMap>}`, (event: Event) => void>;
|
|
3
|
+
/**
|
|
4
|
+
* Construction options when creating an HTML element using:
|
|
5
|
+
* @see Document.createElement
|
|
6
|
+
* @borwwos IElement
|
|
7
|
+
* @borrows Arrayable
|
|
8
|
+
*/
|
|
9
|
+
export type ElementOptions = Partial<Events & Record<string, any> & {
|
|
10
|
+
id: string;
|
|
11
|
+
className: Arrayable<string>;
|
|
12
|
+
children: Arrayable<IElement>;
|
|
13
|
+
dataset: Record<string, string>;
|
|
14
|
+
}>;
|
|
15
|
+
export default ElementOptions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { StringRegex } from "../Types";
|
|
2
|
-
/**
|
|
3
|
-
* Replacement tool for
|
|
4
|
-
* @see String.toSnakeCase
|
|
5
|
-
* @see String.toKebabCase
|
|
6
|
-
* @borrows StringRegex
|
|
7
|
-
*/
|
|
8
|
-
export interface IReplacement {
|
|
9
|
-
replacer?: StringRegex;
|
|
10
|
-
replacement?: string;
|
|
11
|
-
}
|
|
12
|
-
export default IReplacement;
|
|
1
|
+
import { StringRegex } from "../Types";
|
|
2
|
+
/**
|
|
3
|
+
* Replacement tool for
|
|
4
|
+
* @see String.toSnakeCase
|
|
5
|
+
* @see String.toKebabCase
|
|
6
|
+
* @borrows StringRegex
|
|
7
|
+
*/
|
|
8
|
+
export interface IReplacement {
|
|
9
|
+
replacer?: StringRegex;
|
|
10
|
+
replacement?: string;
|
|
11
|
+
}
|
|
12
|
+
export default IReplacement;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './ElementOptions';
|
|
2
|
-
export * from './IReplacement';
|
|
1
|
+
export * from './ElementOptions';
|
|
2
|
+
export * from './IReplacement';
|
package/dist/Interfaces/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ElementOptions"), exports);
|
|
18
|
-
__exportStar(require("./IReplacement"), exports);
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ElementOptions"), exports);
|
|
18
|
+
__exportStar(require("./IReplacement"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Item is function or T
|
|
3
|
+
*/
|
|
4
|
+
export type Functionable<T, Args extends any[] = []> = T | ((...args: Args) => T);
|
|
5
|
+
/**
|
|
6
|
+
* Item is Promise<T> or T
|
|
7
|
+
*/
|
|
8
|
+
export type Promisable<T> = T | Promise<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Item is T or null
|
|
11
|
+
*/
|
|
12
|
+
export type Nullable<T> = T | null;
|
|
13
|
+
/**
|
|
14
|
+
* Item cannot be null or undefined
|
|
15
|
+
*/
|
|
16
|
+
export type NonNullable<T> = T extends null ? never : T extends undefined ? never : T;
|