tiny-essentials 1.28.0 → 1.28.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog/1/28/1.md +23 -0
- package/changelog/1/28/2.md +43 -0
- package/dist/_/numbers.d.mts +91 -16
- package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyAnalogClock.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyDayNightCycle.min.js +1 -1
- package/dist/v1/TinyDragDropDetector.min.js +1 -1
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyElementObserver.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyGamepad.min.js +1 -1
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyI18.min.js +1 -1
- package/dist/v1/TinyIframeEvents.min.js +1 -1
- package/dist/v1/TinyLocalStorage.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyNewWinEvents.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTextDiffer.min.js +1 -1
- package/dist/v1/TinyTextarea.min.js +1 -1
- package/dist/v1/TinyTimeout.min.js +1 -1
- package/dist/v1/TinyToastNotify.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/array.cjs +57 -9
- package/dist/v1/basics/array.d.mts +28 -12
- package/dist/v1/basics/array.mjs +51 -9
- package/dist/v1/basics/clock.cjs +94 -42
- package/dist/v1/basics/clock.d.mts +22 -22
- package/dist/v1/basics/clock.mjs +91 -54
- package/dist/v1/basics/collision.d.mts +245 -104
- package/dist/v1/basics/deprecated/html.cjs +246 -0
- package/dist/v1/basics/deprecated/html.d.mts +63 -0
- package/dist/v1/basics/deprecated/html.mjs +190 -0
- package/dist/v1/basics/extendObjType/Buffer.d.mts +1 -1
- package/dist/v1/basics/fullScreen.d.mts +47 -7
- package/dist/v1/basics/html.cjs +149 -130
- package/dist/v1/basics/html.d.mts +69 -113
- package/dist/v1/basics/html.mjs +113 -105
- package/dist/v1/basics/index.cjs +2 -0
- package/dist/v1/basics/index.d.mts +11 -65
- package/dist/v1/basics/index.mjs +3 -3
- package/dist/v1/basics/mediaContent.cjs +116 -32
- package/dist/v1/basics/mediaContent.d.mts +143 -159
- package/dist/v1/basics/mediaContent.mjs +105 -33
- package/dist/v1/basics/objChecker.cjs +7 -5
- package/dist/v1/basics/objChecker.d.mts +5 -4
- package/dist/v1/basics/objChecker.mjs +6 -6
- package/dist/v1/basics/objFilter.cjs +71 -14
- package/dist/v1/basics/objFilter.d.mts +16 -19
- package/dist/v1/basics/objFilter.mjs +63 -14
- package/dist/v1/basics/simpleMath.cjs +81 -25
- package/dist/v1/basics/simpleMath.d.mts +22 -22
- package/dist/v1/basics/simpleMath.mjs +70 -27
- package/dist/v1/basics/text.cjs +76 -31
- package/dist/v1/basics/text.d.mts +64 -14
- package/dist/v1/basics/text.mjs +62 -31
- 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 +4 -0
- package/dist/v1/index.d.mts +54 -137
- package/dist/v1/index.mjs +4 -3
- package/dist/v1/libs/ColorSafeStringify.d.mts +3 -12
- package/dist/v1/libs/TinyAdvancedRaffle.cjs +64 -50
- package/dist/v1/libs/TinyAdvancedRaffle.d.mts +64 -116
- package/dist/v1/libs/TinyAdvancedRaffle.mjs +62 -49
- package/dist/v1/libs/TinyAfterScrollWatcher.cjs +17 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +15 -19
- package/dist/v1/libs/TinyAfterScrollWatcher.mjs +15 -1
- package/dist/v1/libs/TinyAnalogClock.cjs +60 -0
- package/dist/v1/libs/TinyAnalogClock.d.mts +12 -9
- package/dist/v1/libs/TinyAnalogClock.mjs +57 -0
- 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.cjs +2 -0
- package/dist/v1/libs/TinyClipboard.d.mts +12 -5
- package/dist/v1/libs/TinyClipboard.mjs +2 -0
- package/dist/v1/libs/TinyColorConverter.cjs +1 -0
- package/dist/v1/libs/TinyColorConverter.d.mts +10 -32
- package/dist/v1/libs/TinyColorConverter.mjs +1 -0
- package/dist/v1/libs/TinyColorValidator.d.mts +145 -184
- package/dist/v1/libs/TinyCookieConsent.d.mts +17 -17
- package/dist/v1/libs/TinyDayNightCycle.cjs +67 -42
- package/dist/v1/libs/TinyDayNightCycle.d.mts +87 -117
- package/dist/v1/libs/TinyDayNightCycle.mjs +65 -41
- package/dist/v1/libs/TinyDomReadyManager.d.mts +8 -16
- package/dist/v1/libs/TinyDragDropDetector.cjs +25 -0
- package/dist/v1/libs/TinyDragDropDetector.d.mts +32 -26
- package/dist/v1/libs/TinyDragDropDetector.mjs +22 -0
- package/dist/v1/libs/TinyDragger.cjs +46 -19
- package/dist/v1/libs/TinyDragger.d.mts +82 -81
- package/dist/v1/libs/TinyDragger.mjs +45 -18
- package/dist/v1/libs/TinyElementObserver.cjs +39 -0
- package/dist/v1/libs/TinyElementObserver.d.mts +28 -25
- package/dist/v1/libs/TinyElementObserver.mjs +36 -0
- package/dist/v1/libs/TinyGamepad.cjs +131 -2
- package/dist/v1/libs/TinyGamepad.d.mts +50 -122
- package/dist/v1/libs/TinyGamepad.mjs +129 -2
- 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 +4 -5
- package/dist/v1/libs/TinyHtml.d.mts +1503 -1731
- package/dist/v1/libs/TinyHtml.mjs +5 -6
- package/dist/v1/libs/TinyI18.cjs +61 -0
- package/dist/v1/libs/TinyI18.d.mts +34 -58
- package/dist/v1/libs/TinyI18.mjs +55 -0
- package/dist/v1/libs/TinyIframeEvents.cjs +19 -2
- package/dist/v1/libs/TinyIframeEvents.d.mts +29 -38
- package/dist/v1/libs/TinyIframeEvents.mjs +19 -2
- 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.cjs +48 -0
- package/dist/v1/libs/TinyLocalStorage.d.mts +11 -30
- package/dist/v1/libs/TinyLocalStorage.mjs +45 -0
- package/dist/v1/libs/TinyMamdaniInferenceSystem.d.mts +37 -23
- package/dist/v1/libs/TinyMediaPlayer.cjs +77 -3
- package/dist/v1/libs/TinyMediaPlayer.d.mts +109 -106
- package/dist/v1/libs/TinyMediaPlayer.mjs +71 -3
- package/dist/v1/libs/TinyNeedBar.d.mts +25 -37
- package/dist/v1/libs/TinyNewWinEvents.cjs +29 -0
- package/dist/v1/libs/TinyNewWinEvents.d.mts +32 -29
- package/dist/v1/libs/TinyNewWinEvents.mjs +26 -0
- package/dist/v1/libs/TinyNotifications.d.mts +6 -6
- package/dist/v1/libs/TinyNotifyCenter.cjs +36 -0
- package/dist/v1/libs/TinyNotifyCenter.d.mts +15 -15
- package/dist/v1/libs/TinyNotifyCenter.mjs +32 -0
- package/dist/v1/libs/TinyPromiseQueue.d.mts +11 -11
- package/dist/v1/libs/TinyRadioFm.cjs +70 -12
- package/dist/v1/libs/TinyRadioFm.d.mts +45 -80
- package/dist/v1/libs/TinyRadioFm.mjs +64 -12
- package/dist/v1/libs/TinyRateLimiter.cjs +52 -0
- package/dist/v1/libs/TinyRateLimiter.d.mts +29 -36
- package/dist/v1/libs/TinyRateLimiter.mjs +48 -0
- package/dist/v1/libs/TinySimpleDice.d.mts +17 -36
- package/dist/v1/libs/TinySmartScroller.cjs +52 -3
- package/dist/v1/libs/TinySmartScroller.d.mts +62 -70
- package/dist/v1/libs/TinySmartScroller.mjs +51 -5
- package/dist/v1/libs/TinyTextDiffer.cjs +19 -18
- package/dist/v1/libs/TinyTextDiffer.d.mts +11 -13
- package/dist/v1/libs/TinyTextDiffer.mjs +16 -17
- package/dist/v1/libs/TinyTextRangeEditor.d.mts +8 -8
- package/dist/v1/libs/TinyTextarea.cjs +19 -0
- package/dist/v1/libs/TinyTextarea.d.mts +34 -28
- package/dist/v1/libs/TinyTextarea.mjs +17 -0
- package/dist/v1/libs/TinyTimeout.cjs +11 -1
- package/dist/v1/libs/TinyTimeout.d.mts +14 -14
- package/dist/v1/libs/TinyTimeout.mjs +9 -1
- package/dist/v1/libs/TinyToastNotify.cjs +36 -1
- package/dist/v1/libs/TinyToastNotify.d.mts +15 -17
- package/dist/v1/libs/TinyToastNotify.mjs +32 -1
- package/dist/v1/libs/TinyUploadClicker.cjs +19 -0
- package/dist/v1/libs/TinyUploadClicker.d.mts +38 -8
- package/dist/v1/libs/TinyUploadClicker.mjs +17 -0
- package/dist/v1/libs/UltraRandomMsgGen.cjs +148 -35
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +52 -78
- package/dist/v1/libs/UltraRandomMsgGen.mjs +133 -34
- package/dist/v1/libs/utils.cjs +21 -0
- package/dist/v1/libs/utils.d.mts +6 -0
- package/dist/v1/libs/utils.mjs +16 -0
- package/docs/v1/README.md +1 -0
- package/docs/v1/basics/array.md +2 -2
- package/docs/v1/basics/deprecated/html.md +17 -0
- package/docs/v1/basics/fullScreen.md +1 -1
- package/docs/v1/basics/html.md +12 -26
- package/docs/v1/basics/mediaContent.md +1 -1
- package/docs/v1/basics/objChecker.md +1 -1
- package/docs/v1/basics/text.md +2 -2
- package/docs/v1/fileManager/main.md +1 -1
- package/docs/v1/libs/ColorSafeStringify.md +1 -1
- package/docs/v1/libs/TinyAfterScrollWatcher.md +1 -1
- package/docs/v1/libs/TinyAnalogClock.md +1 -1
- package/docs/v1/libs/TinyArrayComparator.md +1 -1
- package/docs/v1/libs/TinyArrayPaginator.md +1 -1
- package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +2 -2
- package/docs/v1/libs/TinyClassManager.md +1 -1
- package/docs/v1/libs/TinyClipboard.md +1 -1
- package/docs/v1/libs/TinyCookieConsent.md +1 -1
- package/docs/v1/libs/TinyDomReadyManager.md +1 -1
- package/docs/v1/libs/TinyDragDropDetector.md +1 -1
- package/docs/v1/libs/TinyDragger.md +1 -1
- package/docs/v1/libs/TinyElementObserver.md +1 -1
- package/docs/v1/libs/TinyHtml.md +1 -1
- package/docs/v1/libs/TinyIframeEvents.md +2 -2
- package/docs/v1/libs/TinyLevelUp.md +1 -1
- package/docs/v1/libs/TinyLoadingScreen.md +1 -1
- package/docs/v1/libs/TinyNewWinEvents.md +2 -2
- package/docs/v1/libs/TinyNotifications.md +1 -1
- package/docs/v1/libs/TinyPromiseQueue.md +2 -2
- package/docs/v1/libs/TinyTextDiffer.md +1 -1
- package/docs/v1/libs/TinyTextarea.md +1 -1
- package/package.json +11 -2
|
@@ -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
|
/**
|
|
@@ -7,22 +11,22 @@
|
|
|
7
11
|
* If no index is provided, the type is inserted just before 'object' (if it exists), or at the end.
|
|
8
12
|
*
|
|
9
13
|
* @param {ExtendObjType|ExtendObjTypeArray} newItems
|
|
10
|
-
*
|
|
14
|
+
* - New type validators to be added.
|
|
11
15
|
* @param {number} [index] - Optional. Position at which to insert each new type. Ignored if the type already exists.
|
|
12
16
|
* @returns {string[]} - A list of successfully added type names.
|
|
13
17
|
*
|
|
14
18
|
* @example
|
|
15
19
|
* extendObjType({
|
|
16
|
-
*
|
|
20
|
+
* htmlElement2: val => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement
|
|
17
21
|
* });
|
|
18
22
|
*
|
|
19
23
|
* @example
|
|
20
24
|
* extendObjType([
|
|
21
|
-
*
|
|
22
|
-
*
|
|
25
|
+
* ['alpha', val => typeof val === 'string'],
|
|
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.
|
|
@@ -33,24 +37,24 @@ export function extendObjType(newItems: ExtendObjType | ExtendObjTypeArray, inde
|
|
|
33
37
|
*
|
|
34
38
|
* @example
|
|
35
39
|
* reorderObjTypeOrder([
|
|
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[];
|
|
47
51
|
/**
|
|
48
52
|
* Checks the type of a given object or returns its type as a string.
|
|
49
53
|
*
|
|
50
54
|
* @param {*} obj - The object to check or identify.
|
|
51
55
|
* @param {string} [type] - Optional. If provided, checks whether the object matches this type (e.g., "object", "array", "string").
|
|
52
56
|
* @returns {boolean|string|null} - Returns `true` if the type matches, `false` if not,
|
|
53
|
-
*
|
|
57
|
+
* the type string if no type is provided, or `null` if the object is `undefined`.
|
|
54
58
|
*
|
|
55
59
|
* @example
|
|
56
60
|
* objType([], 'array'); // true
|
|
@@ -58,14 +62,14 @@ export function cloneObjTypeOrder(): string[];
|
|
|
58
62
|
* objType('hello'); // "string"
|
|
59
63
|
* objType(undefined); // null
|
|
60
64
|
*/
|
|
61
|
-
export function objType(obj: any, type?: string): boolean | string | null;
|
|
65
|
+
export declare function objType(obj: any, type?: string): boolean | string | null;
|
|
62
66
|
/**
|
|
63
67
|
* Checks the type of a given object and returns the validation value if a known type is detected.
|
|
64
68
|
*
|
|
65
69
|
* @param {*} obj - The object to check or identify.
|
|
66
70
|
* @returns {{ valid:*; type: string | null }} - Returns the type result.
|
|
67
71
|
*/
|
|
68
|
-
export function checkObj(obj: any): {
|
|
72
|
+
export declare function checkObj(obj: any): {
|
|
69
73
|
valid: any;
|
|
70
74
|
type: string | null;
|
|
71
75
|
};
|
|
@@ -73,14 +77,7 @@ export function checkObj(obj: any): {
|
|
|
73
77
|
* Creates a clone of the functions from the `typeValidator` object.
|
|
74
78
|
* It returns a new object where the keys are the same and the values are the cloned functions.
|
|
75
79
|
*/
|
|
76
|
-
export function getCheckObj(): {
|
|
80
|
+
export declare function getCheckObj(): {
|
|
77
81
|
[k: string]: any;
|
|
78
82
|
};
|
|
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
83
|
//# sourceMappingURL=objFilter.d.mts.map
|
|
@@ -28,25 +28,41 @@ const typeValidator = {
|
|
|
28
28
|
* If no index is provided, the type is inserted just before 'object' (if it exists), or at the end.
|
|
29
29
|
*
|
|
30
30
|
* @param {ExtendObjType|ExtendObjTypeArray} newItems
|
|
31
|
-
*
|
|
31
|
+
* - New type validators to be added.
|
|
32
32
|
* @param {number} [index] - Optional. Position at which to insert each new type. Ignored if the type already exists.
|
|
33
33
|
* @returns {string[]} - A list of successfully added type names.
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
36
|
* extendObjType({
|
|
37
|
-
*
|
|
37
|
+
* htmlElement2: val => typeof HTMLElement !== 'undefined' && val instanceof HTMLElement
|
|
38
38
|
* });
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* extendObjType([
|
|
42
|
-
*
|
|
43
|
-
*
|
|
42
|
+
* ['alpha', val => typeof val === 'string'],
|
|
43
|
+
* ['beta', val => Array.isArray(val)]
|
|
44
44
|
* ]);
|
|
45
45
|
*/
|
|
46
46
|
export function extendObjType(newItems, index) {
|
|
47
|
+
if (typeof newItems !== 'object' || newItems === null) {
|
|
48
|
+
throw new TypeError("Argument 'newItems' must be an object or an array.");
|
|
49
|
+
}
|
|
50
|
+
if (typeof index !== 'undefined' && typeof index !== 'number') {
|
|
51
|
+
throw new TypeError("Argument 'index' must be a number.");
|
|
52
|
+
}
|
|
47
53
|
const added = [];
|
|
48
54
|
const entries = Array.isArray(newItems) ? newItems : Object.entries(newItems);
|
|
49
|
-
for (const
|
|
55
|
+
for (const entry of entries) {
|
|
56
|
+
if (!Array.isArray(entry) || entry.length < 2) {
|
|
57
|
+
throw new TypeError("Each item in 'newItems' array must be a [key, function] pair.");
|
|
58
|
+
}
|
|
59
|
+
const [key, fn] = entry;
|
|
60
|
+
if (typeof key !== 'string') {
|
|
61
|
+
throw new TypeError('Validator key must be a string.');
|
|
62
|
+
}
|
|
63
|
+
if (typeof fn !== 'function') {
|
|
64
|
+
throw new TypeError(`Validator for key '${key}' must be a function.`);
|
|
65
|
+
}
|
|
50
66
|
if (!typeValidator.items.hasOwnProperty(key)) {
|
|
51
67
|
// @ts-ignore
|
|
52
68
|
typeValidator.items[key] = fn;
|
|
@@ -74,10 +90,16 @@ export function extendObjType(newItems, index) {
|
|
|
74
90
|
*
|
|
75
91
|
* @example
|
|
76
92
|
* reorderObjTypeOrder([
|
|
77
|
-
*
|
|
93
|
+
* 'string', 'number', 'array', 'object'
|
|
78
94
|
* ]);
|
|
79
95
|
*/
|
|
80
96
|
export function reorderObjTypeOrder(newOrder) {
|
|
97
|
+
if (!Array.isArray(newOrder)) {
|
|
98
|
+
throw new TypeError("Argument 'newOrder' must be an array of strings.");
|
|
99
|
+
}
|
|
100
|
+
if (!newOrder.every((item) => typeof item === 'string')) {
|
|
101
|
+
throw new TypeError("All elements in 'newOrder' must be strings.");
|
|
102
|
+
}
|
|
81
103
|
const currentOrder = [...typeValidator.order]; // shallow clone
|
|
82
104
|
// All keys in newOrder must exist in currentOrder
|
|
83
105
|
const isValid = newOrder.every((type) => currentOrder.includes(type));
|
|
@@ -131,7 +153,7 @@ const getType = (val) => {
|
|
|
131
153
|
* @param {*} obj - The object to check or identify.
|
|
132
154
|
* @param {string} [type] - Optional. If provided, checks whether the object matches this type (e.g., "object", "array", "string").
|
|
133
155
|
* @returns {boolean|string|null} - Returns `true` if the type matches, `false` if not,
|
|
134
|
-
*
|
|
156
|
+
* the type string if no type is provided, or `null` if the object is `undefined`.
|
|
135
157
|
*
|
|
136
158
|
* @example
|
|
137
159
|
* objType([], 'array'); // true
|
|
@@ -142,6 +164,9 @@ const getType = (val) => {
|
|
|
142
164
|
export function objType(obj, type) {
|
|
143
165
|
if (typeof obj === 'undefined')
|
|
144
166
|
return null;
|
|
167
|
+
if (typeof type !== 'undefined' && typeof type !== 'string') {
|
|
168
|
+
throw new TypeError("Argument 'type' must be a string.");
|
|
169
|
+
}
|
|
145
170
|
const result = getType(obj);
|
|
146
171
|
if (typeof type === 'string')
|
|
147
172
|
return result === type.toLowerCase();
|
|
@@ -221,7 +246,10 @@ extendObjType([
|
|
|
221
246
|
],
|
|
222
247
|
[
|
|
223
248
|
'array',
|
|
224
|
-
/**
|
|
249
|
+
/**
|
|
250
|
+
* @template {any} Value
|
|
251
|
+
* @param {*} val @returns {val is Value[]}
|
|
252
|
+
*/
|
|
225
253
|
(val) => Array.isArray(val),
|
|
226
254
|
],
|
|
227
255
|
]);
|
|
@@ -247,27 +275,44 @@ extendObjType([
|
|
|
247
275
|
],
|
|
248
276
|
[
|
|
249
277
|
'map',
|
|
250
|
-
/**
|
|
278
|
+
/**
|
|
279
|
+
* @template {any} Key
|
|
280
|
+
* @template {any} Value
|
|
281
|
+
* @param {*} val @returns {val is Map<Key, Value>}
|
|
282
|
+
*/
|
|
251
283
|
(val) => val instanceof Map,
|
|
252
284
|
],
|
|
253
285
|
[
|
|
254
286
|
'set',
|
|
255
|
-
/**
|
|
287
|
+
/**
|
|
288
|
+
* @template {any} Value
|
|
289
|
+
* @param {*} val @returns {val is Set<Value>}
|
|
290
|
+
*/
|
|
256
291
|
(val) => val instanceof Set,
|
|
257
292
|
],
|
|
258
293
|
[
|
|
259
294
|
'weakmap',
|
|
260
|
-
/**
|
|
295
|
+
/**
|
|
296
|
+
* @template {WeakKey} Key
|
|
297
|
+
* @template {any} Value
|
|
298
|
+
* @param {*} val @returns {val is WeakMap<Key, Value>}
|
|
299
|
+
*/
|
|
261
300
|
(val) => val instanceof WeakMap,
|
|
262
301
|
],
|
|
263
302
|
[
|
|
264
303
|
'weakset',
|
|
265
|
-
/**
|
|
304
|
+
/**
|
|
305
|
+
* @template {WeakKey} Value
|
|
306
|
+
* @param {*} val @returns {val is WeakSet<Value>}
|
|
307
|
+
*/
|
|
266
308
|
(val) => val instanceof WeakSet,
|
|
267
309
|
],
|
|
268
310
|
[
|
|
269
311
|
'promise',
|
|
270
|
-
/**
|
|
312
|
+
/**
|
|
313
|
+
* @template {any} Value
|
|
314
|
+
* @param {*} val @returns {val is Promise<Value>}
|
|
315
|
+
*/
|
|
271
316
|
(val) => val instanceof Promise,
|
|
272
317
|
],
|
|
273
318
|
]);
|
|
@@ -283,7 +328,11 @@ if (isBrowser) {
|
|
|
283
328
|
extendObjType([
|
|
284
329
|
[
|
|
285
330
|
'object',
|
|
286
|
-
/**
|
|
331
|
+
/**
|
|
332
|
+
* @template {string | number | symbol} Key
|
|
333
|
+
* @template {any} Value
|
|
334
|
+
* @param {*} val @returns {val is Record<Key, Value>}
|
|
335
|
+
*/
|
|
287
336
|
(val) => isJsonObject(val),
|
|
288
337
|
],
|
|
289
338
|
]);
|
|
@@ -36,6 +36,14 @@
|
|
|
36
36
|
* ruleOfThree.execute(2, 6, 3, true); // → 4
|
|
37
37
|
*/
|
|
38
38
|
function ruleOfThree(val1, val2, val3, inverse = false) {
|
|
39
|
+
if (typeof val1 !== 'number' || !Number.isFinite(val1))
|
|
40
|
+
throw new TypeError('val1 must be a finite number.');
|
|
41
|
+
if (typeof val2 !== 'number' || !Number.isFinite(val2))
|
|
42
|
+
throw new TypeError('val2 must be a finite number.');
|
|
43
|
+
if (typeof val3 !== 'number' || !Number.isFinite(val3))
|
|
44
|
+
throw new TypeError('val3 must be a finite number.');
|
|
45
|
+
if (typeof inverse !== 'boolean') throw new TypeError('inverse must be a boolean.');
|
|
46
|
+
|
|
39
47
|
return inverse ? Number(val1 * val2) / val3 : Number(val3 * val2) / val1;
|
|
40
48
|
}
|
|
41
49
|
|
|
@@ -52,6 +60,11 @@ function ruleOfThree(val1, val2, val3, inverse = false) {
|
|
|
52
60
|
* getSimplePerc(200, 15); // 30
|
|
53
61
|
*/
|
|
54
62
|
function getSimplePerc(price, percentage) {
|
|
63
|
+
if (typeof price !== 'number' || !Number.isFinite(price))
|
|
64
|
+
throw new TypeError('price must be a finite number.');
|
|
65
|
+
if (typeof percentage !== 'number' || !Number.isFinite(percentage))
|
|
66
|
+
throw new TypeError('percentage must be a finite number.');
|
|
67
|
+
|
|
55
68
|
return price * (percentage / 100);
|
|
56
69
|
}
|
|
57
70
|
|
|
@@ -66,6 +79,11 @@ function getSimplePerc(price, percentage) {
|
|
|
66
79
|
* getPercentage(5, 100); // 5
|
|
67
80
|
*/
|
|
68
81
|
function getPercentage(part, total) {
|
|
82
|
+
if (typeof part !== 'number' || !Number.isFinite(part))
|
|
83
|
+
throw new TypeError('part must be a finite number.');
|
|
84
|
+
if (typeof total !== 'number' || !Number.isFinite(total))
|
|
85
|
+
throw new TypeError('total must be a finite number.');
|
|
86
|
+
|
|
69
87
|
if (total === 0) return 0;
|
|
70
88
|
return (part / total) * 100;
|
|
71
89
|
}
|
|
@@ -78,27 +96,31 @@ function getPercentage(part, total) {
|
|
|
78
96
|
* @returns {number|null} The age in years, or null if `timeData` is not provided or invalid.
|
|
79
97
|
*/
|
|
80
98
|
function getAge(timeData = 0, now = null) {
|
|
81
|
-
if (typeof timeData !== '
|
|
82
|
-
|
|
83
|
-
|
|
99
|
+
if (typeof timeData !== 'number' && typeof timeData !== 'string' && !(timeData instanceof Date)) {
|
|
100
|
+
throw new TypeError('timeData must be a number, string, or Date object.');
|
|
101
|
+
}
|
|
84
102
|
|
|
85
|
-
|
|
103
|
+
if (now !== null && !(now instanceof Date)) {
|
|
104
|
+
throw new TypeError('now must be a Date object or null.');
|
|
105
|
+
}
|
|
86
106
|
|
|
87
|
-
|
|
107
|
+
const birthDate = new Date(timeData);
|
|
108
|
+
if (Number.isNaN(birthDate.getTime())) return null;
|
|
88
109
|
|
|
89
|
-
|
|
90
|
-
const birthMonth = birthDate.getMonth();
|
|
110
|
+
const currentDate = now instanceof Date ? now : new Date();
|
|
91
111
|
|
|
92
|
-
|
|
93
|
-
const birthDay = birthDate.getDate();
|
|
112
|
+
let age = currentDate.getFullYear() - birthDate.getFullYear();
|
|
94
113
|
|
|
95
|
-
|
|
96
|
-
|
|
114
|
+
const currentMonth = currentDate.getMonth();
|
|
115
|
+
const birthMonth = birthDate.getMonth();
|
|
97
116
|
|
|
98
|
-
|
|
99
|
-
|
|
117
|
+
const currentDay = currentDate.getDate();
|
|
118
|
+
const birthDay = birthDate.getDate();
|
|
119
|
+
|
|
120
|
+
// Adjust if birthday hasn't occurred yet this year
|
|
121
|
+
if (currentMonth < birthMonth || (currentMonth === birthMonth && currentDay < birthDay)) age--;
|
|
100
122
|
|
|
101
|
-
return
|
|
123
|
+
return Math.abs(age);
|
|
102
124
|
}
|
|
103
125
|
|
|
104
126
|
/**
|
|
@@ -112,7 +134,7 @@ function getAge(timeData = 0, now = null) {
|
|
|
112
134
|
*
|
|
113
135
|
* @param {number} bytes - The number of bytes to format. Must be a non-negative number.
|
|
114
136
|
* @param {number|null} [decimals=null] - The number of decimal places to include in the result. Defaults to null. If negative, it will be treated as 0. If null, no rounding is applied.
|
|
115
|
-
* @param {
|
|
137
|
+
* @param {'Bytes'|'KB'|'MB'|'GB'|'TB'|'PB'|'EB'|'ZB'|'YB'|null} [maxUnit=null] - Optional unit limit. If provided, restricts conversion to this unit at most (e.g., 'MB' prevents conversion to 'GB' or higher).
|
|
116
138
|
* @returns {FormattedByteResult} An object with the converted value and its corresponding unit. Returns nulls if input is invalid.
|
|
117
139
|
*
|
|
118
140
|
* @example
|
|
@@ -124,12 +146,23 @@ function getAge(timeData = 0, now = null) {
|
|
|
124
146
|
* // → { unit: 'MB', value: 1024 }
|
|
125
147
|
*/
|
|
126
148
|
function formatBytes(bytes, decimals = null, maxUnit = null) {
|
|
127
|
-
if (typeof bytes !== 'number' || bytes < 0)
|
|
149
|
+
if (typeof bytes !== 'number' || !Number.isFinite(bytes) || bytes < 0)
|
|
150
|
+
throw new TypeError('bytes must be a positive number.');
|
|
128
151
|
if (bytes === 0) return { unit: 'Bytes', value: 0 };
|
|
129
152
|
|
|
153
|
+
if (decimals !== null && (typeof decimals !== 'number' || !Number.isFinite(decimals))) {
|
|
154
|
+
throw new TypeError('decimals must be a number or null.');
|
|
155
|
+
}
|
|
156
|
+
|
|
130
157
|
const k = 1024;
|
|
131
158
|
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
132
159
|
|
|
160
|
+
if (maxUnit !== null) {
|
|
161
|
+
if (typeof maxUnit !== 'string') throw new TypeError('maxUnit must be a string or null.');
|
|
162
|
+
if (!sizes.includes(maxUnit))
|
|
163
|
+
throw new RangeError(`maxUnit must be one of: ${sizes.join(', ')}`);
|
|
164
|
+
}
|
|
165
|
+
|
|
133
166
|
const maxIndex = maxUnit && sizes.includes(maxUnit) ? sizes.indexOf(maxUnit) : sizes.length - 1;
|
|
134
167
|
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), maxIndex);
|
|
135
168
|
|
|
@@ -168,8 +201,19 @@ function genFibonacciSeq({
|
|
|
168
201
|
length = 10,
|
|
169
202
|
combiner = (a, b) => a + b,
|
|
170
203
|
} = {}) {
|
|
171
|
-
if (
|
|
172
|
-
|
|
204
|
+
if (
|
|
205
|
+
!Array.isArray(baseValues) ||
|
|
206
|
+
baseValues.length !== 2 ||
|
|
207
|
+
!baseValues.every((value) => typeof value === 'number')
|
|
208
|
+
) {
|
|
209
|
+
throw new Error('baseValues must be an array of exactly two numbers.');
|
|
210
|
+
}
|
|
211
|
+
if (typeof length !== 'number' || !Number.isInteger(length)) {
|
|
212
|
+
throw new RangeError('length must be an integer.');
|
|
213
|
+
}
|
|
214
|
+
if (typeof combiner !== 'function') {
|
|
215
|
+
throw new TypeError('combiner must be a function.');
|
|
216
|
+
}
|
|
173
217
|
|
|
174
218
|
const sequence = [...baseValues.slice(0, 2)];
|
|
175
219
|
|
|
@@ -192,11 +236,19 @@ function genFibonacciSeq({
|
|
|
192
236
|
* @returns {number} The calculated price per unit of the asset.
|
|
193
237
|
*/
|
|
194
238
|
function calculateMarketcap(originalMarketCap, circulatingSupply) {
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
239
|
+
if (
|
|
240
|
+
typeof originalMarketCap !== 'number' ||
|
|
241
|
+
Number.isNaN(originalMarketCap) ||
|
|
242
|
+
!Number.isFinite(originalMarketCap)
|
|
243
|
+
)
|
|
244
|
+
throw new TypeError('Original market cap must be a finite number.');
|
|
245
|
+
if (
|
|
246
|
+
typeof circulatingSupply !== 'number' ||
|
|
247
|
+
Number.isNaN(circulatingSupply) ||
|
|
248
|
+
!Number.isFinite(circulatingSupply)
|
|
249
|
+
)
|
|
250
|
+
throw new TypeError('Circulating supply must be a finite number.');
|
|
251
|
+
if (circulatingSupply <= 0) throw new RangeError('Circulating supply must be greater than zero.');
|
|
200
252
|
return originalMarketCap / circulatingSupply;
|
|
201
253
|
}
|
|
202
254
|
|
|
@@ -212,8 +264,12 @@ function calculateMarketcap(originalMarketCap, circulatingSupply) {
|
|
|
212
264
|
* }}
|
|
213
265
|
*/
|
|
214
266
|
function compareMarketcap(originalMarketCap, circulatingSupply, newMarketCap) {
|
|
215
|
-
if (
|
|
216
|
-
|
|
267
|
+
if (
|
|
268
|
+
typeof newMarketCap !== 'number' ||
|
|
269
|
+
Number.isNaN(newMarketCap) ||
|
|
270
|
+
!Number.isFinite(newMarketCap)
|
|
271
|
+
)
|
|
272
|
+
throw new TypeError('New market cap must be a finite number.');
|
|
217
273
|
const originalPrice = calculateMarketcap(originalMarketCap, circulatingSupply);
|
|
218
274
|
const newPrice = typeof newMarketCap === 'number' ? newMarketCap / circulatingSupply : NaN;
|
|
219
275
|
const priceChangePercent =
|
|
@@ -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.
|
|
@@ -76,7 +86,7 @@ export function getAge(timeData?: number | string | Date, now?: Date | null): nu
|
|
|
76
86
|
*
|
|
77
87
|
* @param {number} bytes - The number of bytes to format. Must be a non-negative number.
|
|
78
88
|
* @param {number|null} [decimals=null] - The number of decimal places to include in the result. Defaults to null. If negative, it will be treated as 0. If null, no rounding is applied.
|
|
79
|
-
* @param {
|
|
89
|
+
* @param {'Bytes'|'KB'|'MB'|'GB'|'TB'|'PB'|'EB'|'ZB'|'YB'|null} [maxUnit=null] - Optional unit limit. If provided, restricts conversion to this unit at most (e.g., 'MB' prevents conversion to 'GB' or higher).
|
|
80
90
|
* @returns {FormattedByteResult} An object with the converted value and its corresponding unit. Returns nulls if input is invalid.
|
|
81
91
|
*
|
|
82
92
|
* @example
|
|
@@ -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?: s
|
|
|
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
|