tiny-essentials 1.28.1 → 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/2.md +43 -0
- package/changelog/1/28/3.md +9 -0
- package/dist/_/numbers.d.mts +91 -16
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/basics/array.d.mts +14 -14
- package/dist/v1/basics/clock.cjs +15 -15
- package/dist/v1/basics/clock.d.mts +21 -21
- package/dist/v1/basics/clock.mjs +15 -15
- package/dist/v1/basics/collision.d.mts +245 -104
- package/dist/v1/basics/deprecated/html.d.mts +33 -33
- package/dist/v1/basics/extendObjType/Buffer.d.mts +1 -1
- package/dist/v1/basics/fullScreen.d.mts +47 -7
- package/dist/v1/basics/html.d.mts +52 -61
- package/dist/v1/basics/index.cjs +2 -0
- package/dist/v1/basics/index.d.mts +11 -67
- package/dist/v1/basics/index.mjs +2 -2
- package/dist/v1/basics/mediaContent.cjs +65 -23
- package/dist/v1/basics/mediaContent.d.mts +144 -73
- package/dist/v1/basics/mediaContent.mjs +65 -23
- package/dist/v1/basics/objChecker.d.mts +2 -2
- package/dist/v1/basics/objFilter.cjs +50 -16
- package/dist/v1/basics/objFilter.d.mts +34 -13
- package/dist/v1/basics/objFilter.mjs +48 -16
- package/dist/v1/basics/simpleMath.d.mts +21 -21
- package/dist/v1/basics/text.d.mts +34 -46
- package/dist/v1/build/ColorSafeStringify.d.mts +1 -1
- package/dist/v1/build/TinyAdvancedRaffle.d.mts +1 -1
- package/dist/v1/build/TinyAfterScrollWatcher.d.mts +1 -1
- package/dist/v1/build/TinyAnalogClock.d.mts +1 -1
- package/dist/v1/build/TinyArrayComparator.d.mts +1 -1
- package/dist/v1/build/TinyArrayPaginator.d.mts +1 -1
- package/dist/v1/build/TinyClassManager.d.mts +1 -1
- package/dist/v1/build/TinyClipboard.d.mts +1 -1
- package/dist/v1/build/TinyColorConverter.d.mts +1 -1
- package/dist/v1/build/TinyColorValidator.d.mts +1 -1
- package/dist/v1/build/TinyCookieConsent.d.mts +1 -1
- package/dist/v1/build/TinyDayNightCycle.d.mts +1 -1
- package/dist/v1/build/TinyDomReadyManager.d.mts +1 -1
- package/dist/v1/build/TinyDragDropDetector.d.mts +1 -1
- package/dist/v1/build/TinyDragger.d.mts +1 -1
- package/dist/v1/build/TinyElementObserver.d.mts +1 -1
- package/dist/v1/build/TinyGamepad.d.mts +1 -1
- package/dist/v1/build/TinyHtml.d.mts +1 -1
- package/dist/v1/build/TinyI18.d.mts +1 -1
- package/dist/v1/build/TinyIframeEvents.d.mts +1 -1
- package/dist/v1/build/TinyInventory.d.mts +1 -1
- package/dist/v1/build/TinyInventoryTrader.d.mts +1 -1
- package/dist/v1/build/TinyLevelUp.d.mts +1 -1
- package/dist/v1/build/TinyLoadingScreen.d.mts +1 -1
- package/dist/v1/build/TinyLocalStorage.d.mts +1 -1
- package/dist/v1/build/TinyMediaPlayer.d.mts +1 -1
- package/dist/v1/build/TinyNeedBar.d.mts +1 -1
- package/dist/v1/build/TinyNewWinEvents.d.mts +1 -1
- package/dist/v1/build/TinyNotifications.d.mts +1 -1
- package/dist/v1/build/TinyNotifyCenter.d.mts +1 -1
- package/dist/v1/build/TinyPromiseQueue.d.mts +1 -1
- package/dist/v1/build/TinyRadioFm.d.mts +1 -1
- package/dist/v1/build/TinyRateLimiter.d.mts +1 -1
- package/dist/v1/build/TinySimpleDice.d.mts +1 -1
- package/dist/v1/build/TinySmartScroller.d.mts +1 -1
- package/dist/v1/build/TinyTextDiffer.d.mts +1 -1
- package/dist/v1/build/TinyTextRangeEditor.d.mts +1 -1
- package/dist/v1/build/TinyTextarea.d.mts +1 -1
- package/dist/v1/build/TinyTimeout.d.mts +1 -1
- package/dist/v1/build/TinyToastNotify.d.mts +1 -1
- package/dist/v1/build/TinyUploadClicker.d.mts +1 -1
- package/dist/v1/build/UltraRandomMsgGen.d.mts +1 -1
- package/dist/v1/fileManager/asyncFuncs.d.mts +13 -13
- package/dist/v1/fileManager/index.d.mts +3 -29
- package/dist/v1/fileManager/normalFuncs.d.mts +22 -22
- package/dist/v1/index.cjs +2 -0
- package/dist/v1/index.d.mts +53 -139
- package/dist/v1/index.mjs +2 -2
- package/dist/v1/libs/ColorSafeStringify.d.mts +3 -12
- package/dist/v1/libs/TinyAdvancedRaffle.d.mts +60 -103
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +11 -18
- package/dist/v1/libs/TinyAnalogClock.d.mts +8 -11
- package/dist/v1/libs/TinyArrayComparator.d.mts +14 -20
- package/dist/v1/libs/TinyArrayPaginator.d.mts +22 -26
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +8 -8
- package/dist/v1/libs/TinyClassManager.cjs +5 -7
- package/dist/v1/libs/TinyClassManager.d.mts +16 -16
- package/dist/v1/libs/TinyClassManager.mjs +5 -6
- package/dist/v1/libs/TinyClipboard.d.mts +8 -3
- package/dist/v1/libs/TinyColorConverter.d.mts +8 -31
- package/dist/v1/libs/TinyColorValidator.d.mts +145 -184
- package/dist/v1/libs/TinyCookieConsent.d.mts +17 -17
- package/dist/v1/libs/TinyDayNightCycle.d.mts +85 -110
- package/dist/v1/libs/TinyDomReadyManager.d.mts +8 -16
- package/dist/v1/libs/TinyDragDropDetector.d.mts +30 -30
- package/dist/v1/libs/TinyDragger.d.mts +82 -81
- package/dist/v1/libs/TinyElementObserver.d.mts +25 -28
- package/dist/v1/libs/TinyGamepad.cjs +0 -1
- package/dist/v1/libs/TinyGamepad.d.mts +50 -122
- package/dist/v1/libs/TinyGamepad.mjs +0 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.cjs +2 -25
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.d.mts +19 -25
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.mjs +3 -27
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.cjs +2 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.d.mts +55 -55
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.mjs +2 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlCanvas.d.mts +6 -6
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.cjs +8 -4
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.d.mts +19 -21
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.mjs +7 -4
- package/dist/v1/libs/TinyHtml/TinyHtmlEmbed.d.mts +8 -8
- package/dist/v1/libs/TinyHtml/TinyHtmlForm.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +5 -6
- package/dist/v1/libs/TinyHtml/TinyHtmlIframe.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.cjs +0 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.d.mts +22 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.mjs +1 -27
- package/dist/v1/libs/TinyHtml/TinyHtmlInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/TinyHtmlLink.d.mts +23 -23
- package/dist/v1/libs/TinyHtml/TinyHtmlMedia.d.mts +26 -26
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.cjs +4 -30
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.d.mts +20 -26
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.mjs +5 -32
- package/dist/v1/libs/TinyHtml/TinyHtmlSelect.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/TinyHtmlStyle.d.mts +8 -8
- package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +26 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.cjs +14 -15
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +32 -32
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.mjs +15 -15
- package/dist/v1/libs/TinyHtml/index.d.mts +102 -45
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.cjs +11 -9
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.d.mts +21 -21
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.mjs +11 -9
- package/dist/v1/libs/TinyHtml/input/TinyHtmlFileInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.cjs +4 -4
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.d.mts +17 -13
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.mjs +4 -4
- package/dist/v1/libs/TinyHtml/input/TinyHtmlImageInput.d.mts +21 -21
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.cjs +5 -4
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.mjs +5 -4
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.d.mts +10 -10
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.cjs +5 -4
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.mjs +5 -4
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.d.mts +15 -11
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.cjs +49 -21
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.d.mts +34 -20
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.mjs +45 -20
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.cjs +48 -25
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.d.mts +27 -21
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.mjs +40 -27
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/number/TinyHtmlNumberInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/number/TinyHtmlRangeInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlEmailInput.d.mts +25 -21
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlPasswordInput.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlSearchInput.d.mts +33 -29
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTelInput.d.mts +22 -22
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTextInput.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlUrlInput.d.mts +31 -27
- package/dist/v1/libs/TinyHtml/media/TinyHtmlAudio.d.mts +35 -11
- package/dist/v1/libs/TinyHtml/media/TinyHtmlObject.d.mts +10 -10
- package/dist/v1/libs/TinyHtml/media/TinyHtmlSource.d.mts +12 -12
- package/dist/v1/libs/TinyHtml/media/TinyHtmlVideo.d.mts +35 -27
- package/dist/v1/libs/TinyHtml.cjs +3 -4
- package/dist/v1/libs/TinyHtml.d.mts +1503 -1731
- package/dist/v1/libs/TinyHtml.mjs +3 -4
- package/dist/v1/libs/TinyI18.d.mts +23 -61
- package/dist/v1/libs/TinyIframeEvents.cjs +1 -1
- package/dist/v1/libs/TinyIframeEvents.d.mts +29 -38
- package/dist/v1/libs/TinyIframeEvents.mjs +1 -1
- package/dist/v1/libs/TinyInventory.d.mts +78 -141
- package/dist/v1/libs/TinyInventoryTrader.d.mts +19 -22
- package/dist/v1/libs/TinyLevelUp.d.mts +10 -13
- package/dist/v1/libs/TinyLoadingScreen.d.mts +21 -31
- package/dist/v1/libs/TinyLocalStorage.d.mts +11 -36
- package/dist/v1/libs/TinyMamdaniInferenceSystem.d.mts +37 -23
- package/dist/v1/libs/TinyMediaPlayer.cjs +5 -3
- package/dist/v1/libs/TinyMediaPlayer.d.mts +102 -109
- package/dist/v1/libs/TinyMediaPlayer.mjs +5 -3
- package/dist/v1/libs/TinyNeedBar.d.mts +25 -37
- package/dist/v1/libs/TinyNewWinEvents.d.mts +29 -32
- package/dist/v1/libs/TinyNotifications.d.mts +6 -6
- package/dist/v1/libs/TinyNotifyCenter.d.mts +15 -21
- package/dist/v1/libs/TinyPromiseQueue.d.mts +11 -11
- package/dist/v1/libs/TinyRadioFm.cjs +32 -12
- package/dist/v1/libs/TinyRadioFm.d.mts +44 -80
- package/dist/v1/libs/TinyRadioFm.mjs +29 -12
- package/dist/v1/libs/TinyRateLimiter.d.mts +26 -39
- package/dist/v1/libs/TinySimpleDice.d.mts +17 -36
- package/dist/v1/libs/TinySmartScroller.d.mts +50 -60
- package/dist/v1/libs/TinyTextDiffer.d.mts +11 -14
- package/dist/v1/libs/TinyTextRangeEditor.d.mts +8 -8
- package/dist/v1/libs/TinyTextarea.d.mts +31 -31
- package/dist/v1/libs/TinyTimeout.d.mts +14 -14
- package/dist/v1/libs/TinyToastNotify.cjs +1 -1
- package/dist/v1/libs/TinyToastNotify.d.mts +15 -23
- package/dist/v1/libs/TinyToastNotify.mjs +1 -1
- package/dist/v1/libs/TinyUploadClicker.d.mts +38 -14
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +44 -84
- package/dist/v1/libs/utils.d.mts +5 -1
- package/docs/v1/basics/deprecated/objFilter.md +14 -0
- package/docs/v1/basics/objFilter.md +31 -17
- package/package.json +2 -2
|
@@ -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
|
}
|
|
@@ -272,7 +281,10 @@ extendObjType([
|
|
|
272
281
|
],
|
|
273
282
|
[
|
|
274
283
|
'array',
|
|
275
|
-
/**
|
|
284
|
+
/**
|
|
285
|
+
* @template {any} Value
|
|
286
|
+
* @param {*} val @returns {val is Value[]}
|
|
287
|
+
*/
|
|
276
288
|
(val) => Array.isArray(val),
|
|
277
289
|
],
|
|
278
290
|
]);
|
|
@@ -300,27 +312,44 @@ extendObjType([
|
|
|
300
312
|
],
|
|
301
313
|
[
|
|
302
314
|
'map',
|
|
303
|
-
/**
|
|
315
|
+
/**
|
|
316
|
+
* @template {any} Key
|
|
317
|
+
* @template {any} Value
|
|
318
|
+
* @param {*} val @returns {val is Map<Key, Value>}
|
|
319
|
+
*/
|
|
304
320
|
(val) => val instanceof Map,
|
|
305
321
|
],
|
|
306
322
|
[
|
|
307
323
|
'set',
|
|
308
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* @template {any} Value
|
|
326
|
+
* @param {*} val @returns {val is Set<Value>}
|
|
327
|
+
*/
|
|
309
328
|
(val) => val instanceof Set,
|
|
310
329
|
],
|
|
311
330
|
[
|
|
312
331
|
'weakmap',
|
|
313
|
-
/**
|
|
332
|
+
/**
|
|
333
|
+
* @template {WeakKey} Key
|
|
334
|
+
* @template {any} Value
|
|
335
|
+
* @param {*} val @returns {val is WeakMap<Key, Value>}
|
|
336
|
+
*/
|
|
314
337
|
(val) => val instanceof WeakMap,
|
|
315
338
|
],
|
|
316
339
|
[
|
|
317
340
|
'weakset',
|
|
318
|
-
/**
|
|
341
|
+
/**
|
|
342
|
+
* @template {WeakKey} Value
|
|
343
|
+
* @param {*} val @returns {val is WeakSet<Value>}
|
|
344
|
+
*/
|
|
319
345
|
(val) => val instanceof WeakSet,
|
|
320
346
|
],
|
|
321
347
|
[
|
|
322
348
|
'promise',
|
|
323
|
-
/**
|
|
349
|
+
/**
|
|
350
|
+
* @template {any} Value
|
|
351
|
+
* @param {*} val @returns {val is Promise<Value>}
|
|
352
|
+
*/
|
|
324
353
|
(val) => val instanceof Promise,
|
|
325
354
|
],
|
|
326
355
|
]);
|
|
@@ -338,7 +367,10 @@ if (isBrowser) {
|
|
|
338
367
|
extendObjType([
|
|
339
368
|
[
|
|
340
369
|
'object',
|
|
341
|
-
/**
|
|
370
|
+
/**
|
|
371
|
+
* @template {Record<string | number | symbol, any>} Value
|
|
372
|
+
* @param {*} val @returns {val is Value}
|
|
373
|
+
*/
|
|
342
374
|
(val) => objChecker.isJsonObject(val),
|
|
343
375
|
],
|
|
344
376
|
]);
|
|
@@ -349,5 +381,7 @@ exports.checkObj = checkObj;
|
|
|
349
381
|
exports.cloneObjTypeOrder = cloneObjTypeOrder;
|
|
350
382
|
exports.extendObjType = extendObjType;
|
|
351
383
|
exports.getCheckObj = getCheckObj;
|
|
384
|
+
exports.isObjType = isObjType;
|
|
352
385
|
exports.objType = objType;
|
|
386
|
+
exports.objTypeName = objTypeName;
|
|
353
387
|
exports.reorderObjTypeOrder = reorderObjTypeOrder;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { countObj, isJsonObject } from './objChecker.mjs';
|
|
2
|
+
export { countObj, isJsonObject };
|
|
3
|
+
export type ExtendObjType = Object<string, (val: any) => any>;
|
|
4
|
+
export type ExtendObjTypeArray = Array<[string, (val: any) => any]>;
|
|
1
5
|
/** @typedef {Object.<string, (val: any) => *>} ExtendObjType */
|
|
2
6
|
/** @typedef {Array<[string, (val: any) => *]>} ExtendObjTypeArray */
|
|
3
7
|
/**
|
|
@@ -22,7 +26,7 @@
|
|
|
22
26
|
* ['beta', val => Array.isArray(val)]
|
|
23
27
|
* ]);
|
|
24
28
|
*/
|
|
25
|
-
export function extendObjType(newItems: ExtendObjType | ExtendObjTypeArray, index?: number): string[];
|
|
29
|
+
export declare function extendObjType(newItems: ExtendObjType | ExtendObjTypeArray, index?: number): string[];
|
|
26
30
|
/**
|
|
27
31
|
* Reorders the typeValidator.order array according to a custom new order.
|
|
28
32
|
* All values in the new order must already exist in the current order.
|
|
@@ -36,17 +40,41 @@ export function extendObjType(newItems: ExtendObjType | ExtendObjTypeArray, inde
|
|
|
36
40
|
* 'string', 'number', 'array', 'object'
|
|
37
41
|
* ]);
|
|
38
42
|
*/
|
|
39
|
-
export function reorderObjTypeOrder(newOrder: string[]): boolean;
|
|
43
|
+
export declare function reorderObjTypeOrder(newOrder: string[]): boolean;
|
|
40
44
|
/**
|
|
41
45
|
* Returns a cloned version of the `typeValidator.order` array.
|
|
42
46
|
* The cloned array will not be affected by future changes to the original `order`.
|
|
43
47
|
*
|
|
44
48
|
* @returns {string[]} - A new array with the same values as `typeValidator.order`.
|
|
45
49
|
*/
|
|
46
|
-
export function cloneObjTypeOrder(): string[];
|
|
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;
|
|
47
74
|
/**
|
|
48
75
|
* Checks the type of a given object or returns its type as a string.
|
|
49
76
|
*
|
|
77
|
+
* @deprecated Use {@link isObjType} or {@link objTypeName} instead.
|
|
50
78
|
* @param {*} obj - The object to check or identify.
|
|
51
79
|
* @param {string} [type] - Optional. If provided, checks whether the object matches this type (e.g., "object", "array", "string").
|
|
52
80
|
* @returns {boolean|string|null} - Returns `true` if the type matches, `false` if not,
|
|
@@ -58,14 +86,14 @@ export function cloneObjTypeOrder(): string[];
|
|
|
58
86
|
* objType('hello'); // "string"
|
|
59
87
|
* objType(undefined); // null
|
|
60
88
|
*/
|
|
61
|
-
export function objType(obj: any, type?: string): boolean | string | null;
|
|
89
|
+
export declare function objType(obj: any, type?: string): boolean | string | null;
|
|
62
90
|
/**
|
|
63
91
|
* Checks the type of a given object and returns the validation value if a known type is detected.
|
|
64
92
|
*
|
|
65
93
|
* @param {*} obj - The object to check or identify.
|
|
66
94
|
* @returns {{ valid:*; type: string | null }} - Returns the type result.
|
|
67
95
|
*/
|
|
68
|
-
export function checkObj(obj: any): {
|
|
96
|
+
export declare function checkObj(obj: any): {
|
|
69
97
|
valid: any;
|
|
70
98
|
type: string | null;
|
|
71
99
|
};
|
|
@@ -73,14 +101,7 @@ export function checkObj(obj: any): {
|
|
|
73
101
|
* Creates a clone of the functions from the `typeValidator` object.
|
|
74
102
|
* It returns a new object where the keys are the same and the values are the cloned functions.
|
|
75
103
|
*/
|
|
76
|
-
export function getCheckObj(): {
|
|
104
|
+
export declare function getCheckObj(): {
|
|
77
105
|
[k: string]: any;
|
|
78
106
|
};
|
|
79
|
-
export type ExtendObjType = {
|
|
80
|
-
[x: string]: (val: any) => any;
|
|
81
|
-
};
|
|
82
|
-
export type ExtendObjTypeArray = Array<[string, (val: any) => any]>;
|
|
83
|
-
import { countObj } from './objChecker.mjs';
|
|
84
|
-
import { isJsonObject } from './objChecker.mjs';
|
|
85
|
-
export { countObj, isJsonObject };
|
|
86
107
|
//# sourceMappingURL=objFilter.d.mts.map
|
|
@@ -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;
|
|
@@ -246,7 +255,10 @@ extendObjType([
|
|
|
246
255
|
],
|
|
247
256
|
[
|
|
248
257
|
'array',
|
|
249
|
-
/**
|
|
258
|
+
/**
|
|
259
|
+
* @template {any} Value
|
|
260
|
+
* @param {*} val @returns {val is Value[]}
|
|
261
|
+
*/
|
|
250
262
|
(val) => Array.isArray(val),
|
|
251
263
|
],
|
|
252
264
|
]);
|
|
@@ -272,27 +284,44 @@ extendObjType([
|
|
|
272
284
|
],
|
|
273
285
|
[
|
|
274
286
|
'map',
|
|
275
|
-
/**
|
|
287
|
+
/**
|
|
288
|
+
* @template {any} Key
|
|
289
|
+
* @template {any} Value
|
|
290
|
+
* @param {*} val @returns {val is Map<Key, Value>}
|
|
291
|
+
*/
|
|
276
292
|
(val) => val instanceof Map,
|
|
277
293
|
],
|
|
278
294
|
[
|
|
279
295
|
'set',
|
|
280
|
-
/**
|
|
296
|
+
/**
|
|
297
|
+
* @template {any} Value
|
|
298
|
+
* @param {*} val @returns {val is Set<Value>}
|
|
299
|
+
*/
|
|
281
300
|
(val) => val instanceof Set,
|
|
282
301
|
],
|
|
283
302
|
[
|
|
284
303
|
'weakmap',
|
|
285
|
-
/**
|
|
304
|
+
/**
|
|
305
|
+
* @template {WeakKey} Key
|
|
306
|
+
* @template {any} Value
|
|
307
|
+
* @param {*} val @returns {val is WeakMap<Key, Value>}
|
|
308
|
+
*/
|
|
286
309
|
(val) => val instanceof WeakMap,
|
|
287
310
|
],
|
|
288
311
|
[
|
|
289
312
|
'weakset',
|
|
290
|
-
/**
|
|
313
|
+
/**
|
|
314
|
+
* @template {WeakKey} Value
|
|
315
|
+
* @param {*} val @returns {val is WeakSet<Value>}
|
|
316
|
+
*/
|
|
291
317
|
(val) => val instanceof WeakSet,
|
|
292
318
|
],
|
|
293
319
|
[
|
|
294
320
|
'promise',
|
|
295
|
-
/**
|
|
321
|
+
/**
|
|
322
|
+
* @template {any} Value
|
|
323
|
+
* @param {*} val @returns {val is Promise<Value>}
|
|
324
|
+
*/
|
|
296
325
|
(val) => val instanceof Promise,
|
|
297
326
|
],
|
|
298
327
|
]);
|
|
@@ -308,7 +337,10 @@ if (isBrowser) {
|
|
|
308
337
|
extendObjType([
|
|
309
338
|
[
|
|
310
339
|
'object',
|
|
311
|
-
/**
|
|
340
|
+
/**
|
|
341
|
+
* @template {Record<string | number | symbol, any>} Value
|
|
342
|
+
* @param {*} val @returns {val is Value}
|
|
343
|
+
*/
|
|
312
344
|
(val) => isJsonObject(val),
|
|
313
345
|
],
|
|
314
346
|
]);
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* // Inverse proportion:
|
|
34
34
|
* ruleOfThree.execute(2, 6, 3, true); // → 4
|
|
35
35
|
*/
|
|
36
|
-
export function ruleOfThree(val1: number, val2: number, val3: number, inverse?: boolean): number;
|
|
36
|
+
export declare function ruleOfThree(val1: number, val2: number, val3: number, inverse?: boolean): number;
|
|
37
37
|
/**
|
|
38
38
|
* Calculates the actual value that corresponds to a percentage of a base number.
|
|
39
39
|
* Unlike `getPercentage`, which tells how much something represents in percent,
|
|
@@ -46,7 +46,7 @@ export function ruleOfThree(val1: number, val2: number, val3: number, inverse?:
|
|
|
46
46
|
* @example
|
|
47
47
|
* getSimplePerc(200, 15); // 30
|
|
48
48
|
*/
|
|
49
|
-
export function getSimplePerc(price: number, percentage: number): number;
|
|
49
|
+
export declare function getSimplePerc(price: number, percentage: number): number;
|
|
50
50
|
/**
|
|
51
51
|
* Calculates how much percent a partial value represents of the total value.
|
|
52
52
|
*
|
|
@@ -57,7 +57,7 @@ export function getSimplePerc(price: number, percentage: number): number;
|
|
|
57
57
|
* @example
|
|
58
58
|
* getPercentage(5, 100); // 5
|
|
59
59
|
*/
|
|
60
|
-
export function getPercentage(part: number, total: number): number;
|
|
60
|
+
export declare function getPercentage(part: number, total: number): number;
|
|
61
61
|
/**
|
|
62
62
|
* Calculates the age based on the given date.
|
|
63
63
|
*
|
|
@@ -65,7 +65,17 @@ export function getPercentage(part: number, total: number): number;
|
|
|
65
65
|
* @param {Date|null} [now=null] - The Date object representing the current date. Defaults to the current date and time if not provided.
|
|
66
66
|
* @returns {number|null} The age in years, or null if `timeData` is not provided or invalid.
|
|
67
67
|
*/
|
|
68
|
-
export function getAge(timeData?: number | string | Date, now?: Date | null): number | null;
|
|
68
|
+
export declare function getAge(timeData?: number | string | Date, now?: Date | null): number | null;
|
|
69
|
+
export type FormattedByteResult = {
|
|
70
|
+
/**
|
|
71
|
+
* - The resulting unit (e.g., 'MB', 'GB') or null if input is invalid.
|
|
72
|
+
*/
|
|
73
|
+
unit: string | null;
|
|
74
|
+
/**
|
|
75
|
+
* - The numerical value in the chosen unit, or null if input is invalid.
|
|
76
|
+
*/
|
|
77
|
+
value: number | null;
|
|
78
|
+
};
|
|
69
79
|
/**
|
|
70
80
|
* @typedef {Object} FormattedByteResult
|
|
71
81
|
* @property {string|null} unit - The resulting unit (e.g., 'MB', 'GB') or null if input is invalid.
|
|
@@ -87,7 +97,7 @@ export function getAge(timeData?: number | string | Date, now?: Date | null): nu
|
|
|
87
97
|
* formatBytes(1073741824, 2, 'MB');
|
|
88
98
|
* // → { unit: 'MB', value: 1024 }
|
|
89
99
|
*/
|
|
90
|
-
export function formatBytes(bytes: number, decimals?: number | null, maxUnit?:
|
|
100
|
+
export declare function formatBytes(bytes: number, decimals?: number | null, maxUnit?: 'Bytes' | 'KB' | 'MB' | 'GB' | 'TB' | 'PB' | 'EB' | 'ZB' | 'YB' | null): FormattedByteResult;
|
|
91
101
|
/**
|
|
92
102
|
* Generates a Fibonacci-like sequence as an array of vectors.
|
|
93
103
|
*
|
|
@@ -107,10 +117,10 @@ export function formatBytes(bytes: number, decimals?: number | null, maxUnit?: "
|
|
|
107
117
|
*
|
|
108
118
|
* @beta
|
|
109
119
|
*/
|
|
110
|
-
export function genFibonacciSeq({ baseValues, length, combiner, }?: {
|
|
111
|
-
baseValues?: number[]
|
|
112
|
-
length?: number
|
|
113
|
-
combiner?: (
|
|
120
|
+
export declare function genFibonacciSeq({ baseValues, length, combiner, }?: {
|
|
121
|
+
baseValues?: number[];
|
|
122
|
+
length?: number;
|
|
123
|
+
combiner?: (a: number, b: number, index: number) => number;
|
|
114
124
|
}): number[];
|
|
115
125
|
/**
|
|
116
126
|
* Calculates the unit price of a coin or token based on the market capitalization and circulating supply.
|
|
@@ -122,7 +132,7 @@ export function genFibonacciSeq({ baseValues, length, combiner, }?: {
|
|
|
122
132
|
* @param {number} circulatingSupply - The number of coins/tokens currently in circulation.
|
|
123
133
|
* @returns {number} The calculated price per unit of the asset.
|
|
124
134
|
*/
|
|
125
|
-
export function calculateMarketcap(originalMarketCap: number, circulatingSupply: number): number;
|
|
135
|
+
export declare function calculateMarketcap(originalMarketCap: number, circulatingSupply: number): number;
|
|
126
136
|
/**
|
|
127
137
|
* Calculates the new price of a coin when the market cap changes.
|
|
128
138
|
* @param {number} originalMarketCap - The original market cap.
|
|
@@ -134,19 +144,9 @@ export function calculateMarketcap(originalMarketCap: number, circulatingSupply:
|
|
|
134
144
|
* priceChangePercent: number
|
|
135
145
|
* }}
|
|
136
146
|
*/
|
|
137
|
-
export function compareMarketcap(originalMarketCap: number, circulatingSupply: number, newMarketCap: number): {
|
|
147
|
+
export declare function compareMarketcap(originalMarketCap: number, circulatingSupply: number, newMarketCap: number): {
|
|
138
148
|
originalPrice: number;
|
|
139
149
|
newPrice: number;
|
|
140
150
|
priceChangePercent: number;
|
|
141
151
|
};
|
|
142
|
-
export type FormattedByteResult = {
|
|
143
|
-
/**
|
|
144
|
-
* - The resulting unit (e.g., 'MB', 'GB') or null if input is invalid.
|
|
145
|
-
*/
|
|
146
|
-
unit: string | null;
|
|
147
|
-
/**
|
|
148
|
-
* - The numerical value in the chosen unit, or null if input is invalid.
|
|
149
|
-
*/
|
|
150
|
-
value: number | null;
|
|
151
|
-
};
|
|
152
152
|
//# sourceMappingURL=simpleMath.d.mts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* return await getUserNameFromMention(mention);
|
|
13
13
|
* });
|
|
14
14
|
*/
|
|
15
|
-
export function asyncReplace(str: string, regex: RegExp, asyncFn: Function): Promise<string>;
|
|
15
|
+
export declare function asyncReplace(str: string, regex: RegExp, asyncFn: Function): Promise<string>;
|
|
16
16
|
/**
|
|
17
17
|
* Converts a string to title case where the first letter of each word is capitalized.
|
|
18
18
|
* All other letters are converted to lowercase.
|
|
@@ -22,7 +22,7 @@ export function asyncReplace(str: string, regex: RegExp, asyncFn: Function): Pro
|
|
|
22
22
|
* @param {string} str - The string to be converted to title case.
|
|
23
23
|
* @returns {string} The string converted to title case.
|
|
24
24
|
*/
|
|
25
|
-
export function toTitleCase(str: string): string;
|
|
25
|
+
export declare function toTitleCase(str: string): string;
|
|
26
26
|
/**
|
|
27
27
|
* Converts a string to title case where the first letter of each word is capitalized,
|
|
28
28
|
* but the first letter of the entire string is left lowercase.
|
|
@@ -32,7 +32,7 @@ export function toTitleCase(str: string): string;
|
|
|
32
32
|
* @param {string} str - The string to be converted to title case with the first letter in lowercase.
|
|
33
33
|
* @returns {string} The string converted to title case with the first letter in lowercase.
|
|
34
34
|
*/
|
|
35
|
-
export function toTitleCaseLowerFirst(str: string): string;
|
|
35
|
+
export declare function toTitleCaseLowerFirst(str: string): string;
|
|
36
36
|
/**
|
|
37
37
|
* Enables a keyboard shortcut to toggle a CSS class on the document body.
|
|
38
38
|
*
|
|
@@ -66,9 +66,9 @@ export function toTitleCaseLowerFirst(str: string): string;
|
|
|
66
66
|
* @param {string} [config.className='detect-made-by-ai'] - The CSS class to toggle on the `<body>` element.
|
|
67
67
|
* @returns {(this: Document, ev: KeyboardEvent) => any} The event handler attached to `document`.
|
|
68
68
|
*/
|
|
69
|
-
export function addAiMarkerShortcut({ key, className }?: {
|
|
70
|
-
key?: string
|
|
71
|
-
className?: string
|
|
69
|
+
export declare function addAiMarkerShortcut({ key, className }?: {
|
|
70
|
+
key?: string;
|
|
71
|
+
className?: string;
|
|
72
72
|
}): (this: Document, ev: KeyboardEvent) => any;
|
|
73
73
|
/**
|
|
74
74
|
* Trims a text string to a specified character limit, attempting to avoid cutting words in half.
|
|
@@ -85,7 +85,31 @@ export function addAiMarkerShortcut({ key, className }?: {
|
|
|
85
85
|
* @throws {TypeError} - Throws if `limit` is not a positive integer.
|
|
86
86
|
* @throws {TypeError} - Throws if `safeCutZone` is not a number between 0 and 1 (inclusive).
|
|
87
87
|
*/
|
|
88
|
-
export function safeTextTrim(text: string, limit: number, safeCutZone?: number): string;
|
|
88
|
+
export declare function safeTextTrim(text: string, limit: number, safeCutZone?: number): string;
|
|
89
|
+
export type DiffStringsModifiedValue<CompareValue extends Record<string, any>> = {
|
|
90
|
+
/**
|
|
91
|
+
* - The value before the modification.
|
|
92
|
+
*/
|
|
93
|
+
old: CompareValue[keyof CompareValue];
|
|
94
|
+
/**
|
|
95
|
+
* - The new value after the modification.
|
|
96
|
+
*/
|
|
97
|
+
new: CompareValue[keyof CompareValue];
|
|
98
|
+
};
|
|
99
|
+
export type DiffStringsData<CompareValue extends Record<string, any>> = {
|
|
100
|
+
/**
|
|
101
|
+
* - Properties that only exist in the new object.
|
|
102
|
+
*/
|
|
103
|
+
added: Partial<CompareValue>;
|
|
104
|
+
/**
|
|
105
|
+
* - Properties that only existed in the old object.
|
|
106
|
+
*/
|
|
107
|
+
removed: Partial<CompareValue>;
|
|
108
|
+
/**
|
|
109
|
+
* - Properties that changed, containing their old and new values.
|
|
110
|
+
*/
|
|
111
|
+
modified: Partial<Record<keyof CompareValue, DiffStringsModifiedValue<CompareValue>>>;
|
|
112
|
+
};
|
|
89
113
|
/**
|
|
90
114
|
* @template {Record<string, any>} CompareValue
|
|
91
115
|
* @typedef {Object} DiffStringsModifiedValue
|
|
@@ -107,20 +131,7 @@ export function safeTextTrim(text: string, limit: number, safeCutZone?: number):
|
|
|
107
131
|
* @param {CompareValue2} newStrings - The new object for comparison.
|
|
108
132
|
* @returns {DiffStringsData<CompareValue1 & CompareValue2>} An object containing what was added, removed, and modified.
|
|
109
133
|
*/
|
|
110
|
-
export function diffObjList<
|
|
111
|
-
/**
|
|
112
|
-
* @template {Record<string, any>} CompareValue
|
|
113
|
-
* @typedef {Object} DiffStringsModifiedValue
|
|
114
|
-
* @property {CompareValue[keyof CompareValue]} old - The value before the modification.
|
|
115
|
-
* @property {CompareValue[keyof CompareValue]} new - The new value after the modification.
|
|
116
|
-
*/
|
|
117
|
-
/**
|
|
118
|
-
* @template {Record<string, any>} CompareValue
|
|
119
|
-
* @typedef {Object} DiffStringsData
|
|
120
|
-
* @property {Partial<CompareValue>} added - Properties that only exist in the new object.
|
|
121
|
-
* @property {Partial<CompareValue>} removed - Properties that only existed in the old object.
|
|
122
|
-
* @property {Partial<Record<keyof CompareValue, DiffStringsModifiedValue<CompareValue>>>} modified - Properties that changed, containing their old and new values.
|
|
123
|
-
*/
|
|
134
|
+
export declare function diffObjList<CompareValue1 extends Record<string, any>, CompareValue2 extends Record<string, any>>(oldStrings: CompareValue1, newStrings: CompareValue2): DiffStringsData<CompareValue1 & CompareValue2>;
|
|
124
135
|
/**
|
|
125
136
|
* Diff two objects.
|
|
126
137
|
* @template {Record<string, any>} CompareValue1
|
|
@@ -128,30 +139,7 @@ export function diffObjList<CompareValue1_1 extends Record<string, any>, Compare
|
|
|
128
139
|
* @param {CompareValue1} oldStrings - The original/old object for comparison.
|
|
129
140
|
* @param {CompareValue2} newStrings - The new object for comparison.
|
|
130
141
|
* @returns {DiffStringsData<CompareValue1 & CompareValue2>} An object containing what was added, removed, and modified.
|
|
142
|
+
* @deprecated Function rename! Use {@link diffObjList} instead.
|
|
131
143
|
*/
|
|
132
|
-
export
|
|
133
|
-
export type DiffStringsModifiedValue<CompareValue extends Record<string, any>> = {
|
|
134
|
-
/**
|
|
135
|
-
* - The value before the modification.
|
|
136
|
-
*/
|
|
137
|
-
old: CompareValue[keyof CompareValue];
|
|
138
|
-
/**
|
|
139
|
-
* - The new value after the modification.
|
|
140
|
-
*/
|
|
141
|
-
new: CompareValue[keyof CompareValue];
|
|
142
|
-
};
|
|
143
|
-
export type DiffStringsData<CompareValue extends Record<string, any>> = {
|
|
144
|
-
/**
|
|
145
|
-
* - Properties that only exist in the new object.
|
|
146
|
-
*/
|
|
147
|
-
added: Partial<CompareValue>;
|
|
148
|
-
/**
|
|
149
|
-
* - Properties that only existed in the old object.
|
|
150
|
-
*/
|
|
151
|
-
removed: Partial<CompareValue>;
|
|
152
|
-
/**
|
|
153
|
-
* - Properties that changed, containing their old and new values.
|
|
154
|
-
*/
|
|
155
|
-
modified: Partial<Record<keyof CompareValue, DiffStringsModifiedValue<CompareValue>>>;
|
|
156
|
-
};
|
|
144
|
+
export declare const diffStrings: typeof diffObjList;
|
|
157
145
|
//# sourceMappingURL=text.d.mts.map
|