tiny-essentials 1.28.2 β 1.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog/1/28/3.md +9 -0
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/basics/index.cjs +2 -0
- package/dist/v1/basics/index.d.mts +2 -2
- package/dist/v1/basics/index.mjs +2 -2
- package/dist/v1/basics/objFilter.cjs +22 -12
- package/dist/v1/basics/objFilter.d.mts +24 -0
- package/dist/v1/basics/objFilter.mjs +20 -12
- package/dist/v1/index.cjs +2 -0
- package/dist/v1/index.d.mts +2 -2
- package/dist/v1/index.mjs +2 -2
- package/docs/v1/basics/deprecated/objFilter.md +14 -0
- package/docs/v1/basics/objFilter.md +31 -17
- package/package.json +1 -1
package/dist/v1/basics/index.cjs
CHANGED
|
@@ -31,7 +31,9 @@ exports.readJsonBlob = html.readJsonBlob;
|
|
|
31
31
|
exports.saveJsonFile = html.saveJsonFile;
|
|
32
32
|
exports.cloneObjTypeOrder = objFilter.cloneObjTypeOrder;
|
|
33
33
|
exports.extendObjType = objFilter.extendObjType;
|
|
34
|
+
exports.isObjType = objFilter.isObjType;
|
|
34
35
|
exports.objType = objFilter.objType;
|
|
36
|
+
exports.objTypeName = objFilter.objTypeName;
|
|
35
37
|
exports.reorderObjTypeOrder = objFilter.reorderObjTypeOrder;
|
|
36
38
|
exports.countObj = objChecker.countObj;
|
|
37
39
|
exports.isJsonObject = objChecker.isJsonObject;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks } from './array.mjs';
|
|
2
2
|
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration } from './clock.mjs';
|
|
3
3
|
import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, fetchText } from './html.mjs';
|
|
4
|
-
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType } from './objFilter.mjs';
|
|
4
|
+
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, isObjType, objTypeName } from './objFilter.mjs';
|
|
5
5
|
import { countObj, isJsonObject } from './objChecker.mjs';
|
|
6
6
|
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange } from './fullScreen.mjs';
|
|
7
7
|
import { calculateMarketcap, compareMarketcap, formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree } from './simpleMath.mjs';
|
|
8
8
|
import { addAiMarkerShortcut, diffStrings, diffObjList, safeTextTrim, toTitleCase, toTitleCaseLowerFirst, asyncReplace } from './text.mjs';
|
|
9
9
|
import { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails } from './collision.mjs';
|
|
10
10
|
import { extractMediaId3Tags, parseMediaMetadata, valMediaContentMetadata, valMediaContentMetadataPartial } from './mediaContent.mjs';
|
|
11
|
-
export { multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
11
|
+
export { multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, isObjType, objTypeName, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
12
12
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/basics/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks } from './array.mjs';
|
|
2
2
|
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, } from './clock.mjs';
|
|
3
3
|
import { readJsonBlob, saveJsonFile, fetchJson, installWindowHiddenScript, readFileBlob, readBase64Blob, fetchText, } from './html.mjs';
|
|
4
|
-
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType } from './objFilter.mjs';
|
|
4
|
+
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, isObjType, objTypeName, } from './objFilter.mjs';
|
|
5
5
|
import { countObj, isJsonObject } from './objChecker.mjs';
|
|
6
6
|
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, } from './fullScreen.mjs';
|
|
7
7
|
import { calculateMarketcap, compareMarketcap, formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree, } from './simpleMath.mjs';
|
|
8
8
|
import { addAiMarkerShortcut, diffStrings, diffObjList, safeTextTrim, toTitleCase, toTitleCaseLowerFirst, asyncReplace, } from './text.mjs';
|
|
9
9
|
import { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, } from './collision.mjs';
|
|
10
10
|
import { extractMediaId3Tags, parseMediaMetadata, valMediaContentMetadata, valMediaContentMetadataPartial, } from './mediaContent.mjs';
|
|
11
|
-
export { multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
11
|
+
export { multiplyArrayBlocks, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, diffStrings, diffObjList, diffArrayList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, isObjType, objTypeName, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
@@ -144,9 +144,6 @@ function cloneObjTypeOrder() {
|
|
|
144
144
|
/**
|
|
145
145
|
* Returns the detected type name of a given value based on predefined type validators.
|
|
146
146
|
*
|
|
147
|
-
* This function uses `getType` with a predefined `typeValidator` to determine or compare types safely.
|
|
148
|
-
* in the specified `typeValidator.order`. The first matching type is returned.
|
|
149
|
-
*
|
|
150
147
|
* If `val` is `null`, it immediately returns `'null'`.
|
|
151
148
|
* If no match is found, it returns `'unknown'`.
|
|
152
149
|
*
|
|
@@ -154,12 +151,11 @@ function cloneObjTypeOrder() {
|
|
|
154
151
|
* @returns {string} - The type name of the value (e.g., "array", "date", "map"), or "unknown" if no match is found.
|
|
155
152
|
*
|
|
156
153
|
* @example
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* getType(() => {}); // "unknown"
|
|
154
|
+
* objTypeName([]); // "array"
|
|
155
|
+
* objTypeName(null); // "null"
|
|
156
|
+
* objTypeName(new Set()); // "set"
|
|
161
157
|
*/
|
|
162
|
-
const
|
|
158
|
+
const objTypeName = (val) => {
|
|
163
159
|
if (val === null) return 'null';
|
|
164
160
|
// @ts-ignore
|
|
165
161
|
for (const name of typeValidator.order) {
|
|
@@ -170,9 +166,22 @@ const getType = (val) => {
|
|
|
170
166
|
return 'unknown';
|
|
171
167
|
};
|
|
172
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Checks the type of a given object.
|
|
171
|
+
*
|
|
172
|
+
* @param {*} obj - The object to check.
|
|
173
|
+
* @param {string} [type] - Checks whether the object matches this type (e.g., "object", "array", "string").
|
|
174
|
+
* @returns {boolean} - Returns `true` if the type matches.
|
|
175
|
+
*/
|
|
176
|
+
function isObjType(obj, type) {
|
|
177
|
+
if (typeof type !== 'string') throw new TypeError("Argument 'type' must be a string.");
|
|
178
|
+
return objTypeName(obj) === type.toLowerCase();
|
|
179
|
+
}
|
|
180
|
+
|
|
173
181
|
/**
|
|
174
182
|
* Checks the type of a given object or returns its type as a string.
|
|
175
183
|
*
|
|
184
|
+
* @deprecated Use {@link isObjType} or {@link objTypeName} instead.
|
|
176
185
|
* @param {*} obj - The object to check or identify.
|
|
177
186
|
* @param {string} [type] - Optional. If provided, checks whether the object matches this type (e.g., "object", "array", "string").
|
|
178
187
|
* @returns {boolean|string|null} - Returns `true` if the type matches, `false` if not,
|
|
@@ -190,7 +199,7 @@ function objType(obj, type) {
|
|
|
190
199
|
throw new TypeError("Argument 'type' must be a string.");
|
|
191
200
|
}
|
|
192
201
|
|
|
193
|
-
const result =
|
|
202
|
+
const result = objTypeName(obj);
|
|
194
203
|
if (typeof type === 'string') return result === type.toLowerCase();
|
|
195
204
|
return result;
|
|
196
205
|
}
|
|
@@ -359,9 +368,8 @@ extendObjType([
|
|
|
359
368
|
[
|
|
360
369
|
'object',
|
|
361
370
|
/**
|
|
362
|
-
* @template {string | number | symbol}
|
|
363
|
-
* @
|
|
364
|
-
* @param {*} val @returns {val is Record<Key, Value>}
|
|
371
|
+
* @template {Record<string | number | symbol, any>} Value
|
|
372
|
+
* @param {*} val @returns {val is Value}
|
|
365
373
|
*/
|
|
366
374
|
(val) => objChecker.isJsonObject(val),
|
|
367
375
|
],
|
|
@@ -373,5 +381,7 @@ exports.checkObj = checkObj;
|
|
|
373
381
|
exports.cloneObjTypeOrder = cloneObjTypeOrder;
|
|
374
382
|
exports.extendObjType = extendObjType;
|
|
375
383
|
exports.getCheckObj = getCheckObj;
|
|
384
|
+
exports.isObjType = isObjType;
|
|
376
385
|
exports.objType = objType;
|
|
386
|
+
exports.objTypeName = objTypeName;
|
|
377
387
|
exports.reorderObjTypeOrder = reorderObjTypeOrder;
|
|
@@ -48,9 +48,33 @@ export declare function reorderObjTypeOrder(newOrder: string[]): boolean;
|
|
|
48
48
|
* @returns {string[]} - A new array with the same values as `typeValidator.order`.
|
|
49
49
|
*/
|
|
50
50
|
export declare function cloneObjTypeOrder(): string[];
|
|
51
|
+
/**
|
|
52
|
+
* Returns the detected type name of a given value based on predefined type validators.
|
|
53
|
+
*
|
|
54
|
+
* If `val` is `null`, it immediately returns `'null'`.
|
|
55
|
+
* If no match is found, it returns `'unknown'`.
|
|
56
|
+
*
|
|
57
|
+
* @param {any} val - The value whose type should be determined.
|
|
58
|
+
* @returns {string} - The type name of the value (e.g., "array", "date", "map"), or "unknown" if no match is found.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* objTypeName([]); // "array"
|
|
62
|
+
* objTypeName(null); // "null"
|
|
63
|
+
* objTypeName(new Set()); // "set"
|
|
64
|
+
*/
|
|
65
|
+
export declare const objTypeName: (val: any) => string;
|
|
66
|
+
/**
|
|
67
|
+
* Checks the type of a given object.
|
|
68
|
+
*
|
|
69
|
+
* @param {*} obj - The object to check.
|
|
70
|
+
* @param {string} [type] - Checks whether the object matches this type (e.g., "object", "array", "string").
|
|
71
|
+
* @returns {boolean} - Returns `true` if the type matches.
|
|
72
|
+
*/
|
|
73
|
+
export declare function isObjType(obj: any, type?: string): boolean;
|
|
51
74
|
/**
|
|
52
75
|
* Checks the type of a given object or returns its type as a string.
|
|
53
76
|
*
|
|
77
|
+
* @deprecated Use {@link isObjType} or {@link objTypeName} instead.
|
|
54
78
|
* @param {*} obj - The object to check or identify.
|
|
55
79
|
* @param {string} [type] - Optional. If provided, checks whether the object matches this type (e.g., "object", "array", "string").
|
|
56
80
|
* @returns {boolean|string|null} - Returns `true` if the type matches, `false` if not,
|
|
@@ -121,9 +121,6 @@ export function cloneObjTypeOrder() {
|
|
|
121
121
|
/**
|
|
122
122
|
* Returns the detected type name of a given value based on predefined type validators.
|
|
123
123
|
*
|
|
124
|
-
* This function uses `getType` with a predefined `typeValidator` to determine or compare types safely.
|
|
125
|
-
* in the specified `typeValidator.order`. The first matching type is returned.
|
|
126
|
-
*
|
|
127
124
|
* If `val` is `null`, it immediately returns `'null'`.
|
|
128
125
|
* If no match is found, it returns `'unknown'`.
|
|
129
126
|
*
|
|
@@ -131,12 +128,11 @@ export function cloneObjTypeOrder() {
|
|
|
131
128
|
* @returns {string} - The type name of the value (e.g., "array", "date", "map"), or "unknown" if no match is found.
|
|
132
129
|
*
|
|
133
130
|
* @example
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* getType(() => {}); // "unknown"
|
|
131
|
+
* objTypeName([]); // "array"
|
|
132
|
+
* objTypeName(null); // "null"
|
|
133
|
+
* objTypeName(new Set()); // "set"
|
|
138
134
|
*/
|
|
139
|
-
const
|
|
135
|
+
export const objTypeName = (val) => {
|
|
140
136
|
if (val === null)
|
|
141
137
|
return 'null';
|
|
142
138
|
// @ts-ignore
|
|
@@ -147,9 +143,22 @@ const getType = (val) => {
|
|
|
147
143
|
}
|
|
148
144
|
return 'unknown';
|
|
149
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* Checks the type of a given object.
|
|
148
|
+
*
|
|
149
|
+
* @param {*} obj - The object to check.
|
|
150
|
+
* @param {string} [type] - Checks whether the object matches this type (e.g., "object", "array", "string").
|
|
151
|
+
* @returns {boolean} - Returns `true` if the type matches.
|
|
152
|
+
*/
|
|
153
|
+
export function isObjType(obj, type) {
|
|
154
|
+
if (typeof type !== 'string')
|
|
155
|
+
throw new TypeError("Argument 'type' must be a string.");
|
|
156
|
+
return objTypeName(obj) === type.toLowerCase();
|
|
157
|
+
}
|
|
150
158
|
/**
|
|
151
159
|
* Checks the type of a given object or returns its type as a string.
|
|
152
160
|
*
|
|
161
|
+
* @deprecated Use {@link isObjType} or {@link objTypeName} instead.
|
|
153
162
|
* @param {*} obj - The object to check or identify.
|
|
154
163
|
* @param {string} [type] - Optional. If provided, checks whether the object matches this type (e.g., "object", "array", "string").
|
|
155
164
|
* @returns {boolean|string|null} - Returns `true` if the type matches, `false` if not,
|
|
@@ -167,7 +176,7 @@ export function objType(obj, type) {
|
|
|
167
176
|
if (typeof type !== 'undefined' && typeof type !== 'string') {
|
|
168
177
|
throw new TypeError("Argument 'type' must be a string.");
|
|
169
178
|
}
|
|
170
|
-
const result =
|
|
179
|
+
const result = objTypeName(obj);
|
|
171
180
|
if (typeof type === 'string')
|
|
172
181
|
return result === type.toLowerCase();
|
|
173
182
|
return result;
|
|
@@ -329,9 +338,8 @@ extendObjType([
|
|
|
329
338
|
[
|
|
330
339
|
'object',
|
|
331
340
|
/**
|
|
332
|
-
* @template {string | number | symbol}
|
|
333
|
-
* @
|
|
334
|
-
* @param {*} val @returns {val is Record<Key, Value>}
|
|
341
|
+
* @template {Record<string | number | symbol, any>} Value
|
|
342
|
+
* @param {*} val @returns {val is Value}
|
|
335
343
|
*/
|
|
336
344
|
(val) => isJsonObject(val),
|
|
337
345
|
],
|
package/dist/v1/index.cjs
CHANGED
|
@@ -71,7 +71,9 @@ exports.getTimeDuration = clock.getTimeDuration;
|
|
|
71
71
|
exports.checkObj = objFilter.checkObj;
|
|
72
72
|
exports.cloneObjTypeOrder = objFilter.cloneObjTypeOrder;
|
|
73
73
|
exports.extendObjType = objFilter.extendObjType;
|
|
74
|
+
exports.isObjType = objFilter.isObjType;
|
|
74
75
|
exports.objType = objFilter.objType;
|
|
76
|
+
exports.objTypeName = objFilter.objTypeName;
|
|
75
77
|
exports.reorderObjTypeOrder = objFilter.reorderObjTypeOrder;
|
|
76
78
|
exports.countObj = objChecker.countObj;
|
|
77
79
|
exports.isJsonObject = objChecker.isJsonObject;
|
package/dist/v1/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import TinyLevelUp from './libs/TinyLevelUp.mjs';
|
|
2
2
|
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks } from './basics/array.mjs';
|
|
3
3
|
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration } from './basics/clock.mjs';
|
|
4
|
-
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, checkObj } from './basics/objFilter.mjs';
|
|
4
|
+
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, checkObj, objTypeName, isObjType } from './basics/objFilter.mjs';
|
|
5
5
|
import { countObj, isJsonObject } from './basics/objChecker.mjs';
|
|
6
6
|
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange } from './basics/fullScreen.mjs';
|
|
7
7
|
import { calculateMarketcap, compareMarketcap, formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree } from './basics/simpleMath.mjs';
|
|
@@ -53,5 +53,5 @@ import TinyClassManager from './libs/TinyClassManager.mjs';
|
|
|
53
53
|
import TinyRadioFm from './libs/TinyRadioFm.mjs';
|
|
54
54
|
import TinyMediaPlayer from './libs/TinyMediaPlayer.mjs';
|
|
55
55
|
import { createCheckDestroyed } from './libs/utils.mjs';
|
|
56
|
-
export { TinyMediaPlayer, TinyRadioFm, TinyClassManager, FuzzySet, MamdaniInferenceSystem, TinyArrayComparator, TinyTextDiffer, TinyAnalogClock, TinyColorValidator, TinyLoadingScreen, TinyElementObserver, TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, multiplyArrayBlocks, createCheckDestroyed, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, defuzzifyCentroid, trapezoid, diffArrayList, diffStrings, diffObjList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getLatestBackupPath, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
56
|
+
export { TinyMediaPlayer, TinyRadioFm, TinyClassManager, FuzzySet, MamdaniInferenceSystem, TinyArrayComparator, TinyTextDiffer, TinyAnalogClock, TinyColorValidator, TinyLoadingScreen, TinyElementObserver, TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, multiplyArrayBlocks, createCheckDestroyed, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, defuzzifyCentroid, trapezoid, diffArrayList, diffStrings, diffObjList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getLatestBackupPath, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objTypeName, isObjType, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
57
57
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import TinyLevelUp from './libs/TinyLevelUp.mjs';
|
|
2
2
|
import { diffArrayList, shuffleArray, arraySortPositions, multiplyArrayBlocks, } from './basics/array.mjs';
|
|
3
3
|
import { breakdownDuration, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, } from './basics/clock.mjs';
|
|
4
|
-
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, checkObj, } from './basics/objFilter.mjs';
|
|
4
|
+
import { extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, objType, checkObj, objTypeName, isObjType, } from './basics/objFilter.mjs';
|
|
5
5
|
import { countObj, isJsonObject } from './basics/objChecker.mjs';
|
|
6
6
|
import { documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, } from './basics/fullScreen.mjs';
|
|
7
7
|
import { calculateMarketcap, compareMarketcap, formatBytes, genFibonacciSeq, getAge, getPercentage, getSimplePerc, ruleOfThree, } from './basics/simpleMath.mjs';
|
|
@@ -56,4 +56,4 @@ import { createCheckDestroyed } from './libs/utils.mjs';
|
|
|
56
56
|
// import TinyHtmlElems from './libs/TinyHtml/index.mjs';
|
|
57
57
|
export { TinyMediaPlayer, TinyRadioFm, TinyClassManager, FuzzySet, MamdaniInferenceSystem, TinyArrayComparator, TinyTextDiffer, TinyAnalogClock,
|
|
58
58
|
// TinyHtmlElems,
|
|
59
|
-
TinyColorValidator, TinyLoadingScreen, TinyElementObserver, TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, multiplyArrayBlocks, createCheckDestroyed, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, defuzzifyCentroid, trapezoid, diffArrayList, diffStrings, diffObjList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getLatestBackupPath, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
59
|
+
TinyColorValidator, TinyLoadingScreen, TinyElementObserver, TinySimpleDice, TinyNeedBar, TinyI18, TinyCookieConsent, TinyInventory, TinyInventoryTrader, TinyArrayPaginator, TinyAdvancedRaffle, TinyDayNightCycle, TinyGamepad, TinyTextarea, TinyNewWinEvents, TinyIframeEvents, TinyLocalStorage, TinyTimeout, TinyColorConverter, TinyClipboard, TinyTextRangeEditor, TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, multiplyArrayBlocks, createCheckDestroyed, valMediaContentMetadata, valMediaContentMetadataPartial, parseMediaMetadata, extractMediaId3Tags, defuzzifyCentroid, trapezoid, diffArrayList, diffStrings, diffObjList, breakdownDuration, calculateMarketcap, compareMarketcap, getPercentage, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getLatestBackupPath, fetchJson, fetchText, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objTypeName, isObjType, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
### π `objType(obj, [type])`
|
|
2
|
+
|
|
3
|
+
Get the type of any value, or check it against a known type.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
objType([], 'array'); // true
|
|
7
|
+
objType('hello'); // "string"
|
|
8
|
+
objType(undefined); // null
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
- `true` / `false` if a type is provided
|
|
13
|
+
- The detected type name as a string if no type is provided
|
|
14
|
+
- `null` if `undefined` is passed
|
|
@@ -23,23 +23,6 @@ Whether youβre validating inputs, writing schema validators, or building tools
|
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
26
|
-
### π `objType(obj, [type])`
|
|
27
|
-
|
|
28
|
-
Get the type of any value, or check it against a known type.
|
|
29
|
-
|
|
30
|
-
```js
|
|
31
|
-
objType([], 'array'); // true
|
|
32
|
-
objType('hello'); // "string"
|
|
33
|
-
objType(undefined); // null
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Returns:
|
|
37
|
-
- `true` / `false` if a type is provided
|
|
38
|
-
- The detected type name as a string if no type is provided
|
|
39
|
-
- `null` if `undefined` is passed
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
26
|
### π `checkObj(obj)`
|
|
44
27
|
|
|
45
28
|
Checks the type of a given object and returns the validation result if a known type is detected.
|
|
@@ -73,6 +56,37 @@ Returns:
|
|
|
73
56
|
|
|
74
57
|
---
|
|
75
58
|
|
|
59
|
+
### π·οΈ `objTypeName(val)`
|
|
60
|
+
|
|
61
|
+
Returns the detected type name of a given value as a string.
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
objTypeName([]); // "array"
|
|
65
|
+
objTypeName(null); // "null"
|
|
66
|
+
objTypeName(new Set()); // "set"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
- A string representing the type name (e.g., `"array"`, `"date"`, `"map"`).
|
|
71
|
+
- `"unknown"` if no matching type is found.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### β
`isObjType(obj, type)`
|
|
76
|
+
|
|
77
|
+
Checks whether a given object matches a specific type. This check is case-insensitive.
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
isObjType([], 'array'); // true
|
|
81
|
+
isObjType({}, 'object'); // true
|
|
82
|
+
isObjType('hello', 'string'); // true
|
|
83
|
+
isObjType(123, 'boolean'); // false
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
*Note: Throws a `TypeError` if the `type` argument is not a string.*
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
76
90
|
### β `extendObjType(newTypes, [index])`
|
|
77
91
|
|
|
78
92
|
Add your own custom types. You can optionally define where in the check order they go.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-essentials",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.3",
|
|
4
4
|
"description": "Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tiny-essentials-fork": "./TinyFork.mjs"
|