tiny-essentials 1.28.15 → 1.28.17
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/TinyFork.mjs +45 -23
- package/changelog/1/28/16.md +19 -0
- package/changelog/1/28/17.md +11 -0
- package/dist/_/numbers.d.mts.map +1 -0
- package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyDebugger.min.js +1 -1
- package/dist/v1/TinyEssentials.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/TinyRadioFm.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/basics/array.d.mts.map +1 -0
- package/dist/v1/basics/browserDetector.d.mts.map +1 -0
- package/dist/v1/basics/clock.d.mts.map +1 -0
- package/dist/v1/basics/collision.d.mts.map +1 -0
- package/dist/v1/basics/deprecated/html.d.mts.map +1 -0
- package/dist/v1/basics/extendObjType/Buffer.d.mts.map +1 -0
- package/dist/v1/basics/fullScreen.d.mts.map +1 -0
- package/dist/v1/basics/html.d.mts.map +1 -0
- package/dist/v1/basics/index.cjs +4 -0
- package/dist/v1/basics/index.d.mts +2 -1
- package/dist/v1/basics/index.d.mts.map +1 -0
- package/dist/v1/basics/index.mjs +2 -1
- package/dist/v1/basics/jsonFilter.cjs +267 -0
- package/dist/v1/basics/jsonFilter.d.mts +91 -0
- package/dist/v1/basics/jsonFilter.d.mts.map +1 -0
- package/dist/v1/basics/jsonFilter.mjs +237 -0
- package/dist/v1/basics/mediaContent.cjs +96 -104
- package/dist/v1/basics/mediaContent.d.mts.map +1 -0
- package/dist/v1/basics/mediaContent.mjs +94 -102
- package/dist/v1/basics/objChecker.d.mts.map +1 -0
- package/dist/v1/basics/objFilter.d.mts.map +1 -0
- package/dist/v1/basics/promiseUtils.d.mts.map +1 -0
- package/dist/v1/basics/simpleMath.d.mts.map +1 -0
- package/dist/v1/basics/text.d.mts.map +1 -0
- package/dist/v1/fileManager/asyncFuncs.d.mts.map +1 -0
- package/dist/v1/fileManager/index.d.mts.map +1 -0
- package/dist/v1/fileManager/normalFuncs.d.mts.map +1 -0
- package/dist/v1/index.cjs +53 -45
- package/dist/v1/index.d.mts +48 -45
- package/dist/v1/index.d.mts.map +1 -0
- package/dist/v1/index.mjs +48 -45
- package/dist/v1/libs/array/TinyArrayComparator.d.mts.map +1 -0
- package/dist/v1/libs/array/TinyArrayPaginator.d.mts.map +1 -0
- package/dist/v1/libs/color/ColorSafeStringify.d.mts.map +1 -0
- package/dist/v1/libs/color/TinyColorConverter.d.mts.map +1 -0
- package/dist/v1/libs/color/TinyColorValidator.d.mts.map +1 -0
- package/dist/v1/libs/{TinyDayNightCycle.cjs → game/TinyDayNightCycle.cjs} +2 -2
- package/dist/v1/libs/game/TinyDayNightCycle.d.mts.map +1 -0
- package/dist/v1/libs/{TinyDayNightCycle.mjs → game/TinyDayNightCycle.mjs} +1 -1
- package/dist/v1/libs/{TinyGamepad.cjs → game/TinyGamepad.cjs} +2 -2
- package/dist/v1/libs/game/TinyGamepad.d.mts.map +1 -0
- package/dist/v1/libs/{TinyGamepad.mjs → game/TinyGamepad.mjs} +1 -1
- package/dist/v1/libs/game/TinyInventory.d.mts.map +1 -0
- package/dist/v1/libs/game/TinyInventoryTrader.d.mts.map +1 -0
- package/dist/v1/libs/game/TinyLevelUp.d.mts.map +1 -0
- package/dist/v1/libs/game/TinyNeedBar.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyDomReadyManager.d.mts.map +1 -0
- package/dist/v1/libs/{TinyElementObserver.cjs → html/TinyElementObserver.cjs} +2 -2
- package/dist/v1/libs/html/TinyElementObserver.d.mts.map +1 -0
- package/dist/v1/libs/{TinyElementObserver.mjs → html/TinyElementObserver.mjs} +1 -1
- package/dist/v1/libs/html/TinyHtml/TinyHtmlAnchor.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlButton.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlCanvas.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlDatalist.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlEmbed.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlForm.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlIcon.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlIframe.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlImage.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlLink.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlMedia.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlScript.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlSelect.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlStyle.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlTemplate.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/TinyHtmlTextarea.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/index.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/TinyHtmlColorInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/TinyHtmlFileInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/TinyHtmlHiddenInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/TinyHtmlImageInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/button/TinyHtmlButtonInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/button/TinyHtmlResetInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/button/TinyHtmlSubmitInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/check/TinyHtmlCheckboxInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/check/TinyHtmlRadioInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/date/TinyHtmlDateInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/date/TinyHtmlDateTimeInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/date/TinyHtmlMonthInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/date/TinyHtmlTimeInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/date/TinyHtmlWeekInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/number/TinyHtmlNumberInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/number/TinyHtmlRangeInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/text/TinyHtmlEmailInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/text/TinyHtmlPasswordInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/text/TinyHtmlSearchInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/text/TinyHtmlTelInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/text/TinyHtmlTextInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/input/text/TinyHtmlUrlInput.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/media/TinyHtmlAudio.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/media/TinyHtmlObject.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/media/TinyHtmlSource.d.mts.map +1 -0
- package/dist/v1/libs/html/TinyHtml/media/TinyHtmlVideo.d.mts.map +1 -0
- package/dist/v1/libs/{TinyHtml.cjs → html/TinyHtml.cjs} +4 -4
- package/dist/v1/libs/{TinyHtml.d.mts → html/TinyHtml.d.mts} +3 -3
- package/dist/v1/libs/html/TinyHtml.d.mts.map +1 -0
- package/dist/v1/libs/{TinyHtml.mjs → html/TinyHtml.mjs} +4 -4
- package/dist/v1/libs/{TinyDragDropDetector.cjs → html/drag/TinyDragDropDetector.cjs} +2 -2
- package/dist/v1/libs/html/drag/TinyDragDropDetector.d.mts.map +1 -0
- package/dist/v1/libs/{TinyDragDropDetector.mjs → html/drag/TinyDragDropDetector.mjs} +1 -1
- package/dist/v1/libs/{TinyDragger.cjs → html/drag/TinyDragger.cjs} +5 -5
- package/dist/v1/libs/{TinyDragger.d.mts → html/drag/TinyDragger.d.mts} +2 -2
- package/dist/v1/libs/html/drag/TinyDragger.d.mts.map +1 -0
- package/dist/v1/libs/{TinyDragger.mjs → html/drag/TinyDragger.mjs} +4 -4
- package/dist/v1/libs/{TinyIframeEvents.cjs → html/events/TinyIframeEvents.cjs} +3 -3
- package/dist/v1/libs/html/events/TinyIframeEvents.d.mts.map +1 -0
- package/dist/v1/libs/{TinyIframeEvents.mjs → html/events/TinyIframeEvents.mjs} +2 -2
- package/dist/v1/libs/{TinyNewWinEvents.cjs → html/events/TinyNewWinEvents.cjs} +2 -2
- package/dist/v1/libs/html/events/TinyNewWinEvents.d.mts.map +1 -0
- package/dist/v1/libs/{TinyNewWinEvents.mjs → html/events/TinyNewWinEvents.mjs} +1 -1
- package/dist/v1/libs/{TinyNotifications.cjs → html/notification/TinyNotifications.cjs} +1 -1
- package/dist/v1/libs/html/notification/TinyNotifications.d.mts.map +1 -0
- package/dist/v1/libs/{TinyNotifications.mjs → html/notification/TinyNotifications.mjs} +1 -1
- package/dist/v1/libs/{TinyNotifyCenter.cjs → html/notification/TinyNotifyCenter.cjs} +2 -2
- package/dist/v1/libs/html/notification/TinyNotifyCenter.d.mts.map +1 -0
- package/dist/v1/libs/{TinyNotifyCenter.mjs → html/notification/TinyNotifyCenter.mjs} +1 -1
- package/dist/v1/libs/{TinyToastNotify.cjs → html/notification/TinyToastNotify.cjs} +2 -2
- package/dist/v1/libs/html/notification/TinyToastNotify.d.mts.map +1 -0
- package/dist/v1/libs/{TinyToastNotify.mjs → html/notification/TinyToastNotify.mjs} +1 -1
- package/dist/v1/libs/{TinyAfterScrollWatcher.cjs → html/scroll/TinyAfterScrollWatcher.cjs} +2 -2
- package/dist/v1/libs/html/scroll/TinyAfterScrollWatcher.d.mts.map +1 -0
- package/dist/v1/libs/{TinyAfterScrollWatcher.mjs → html/scroll/TinyAfterScrollWatcher.mjs} +1 -1
- package/dist/v1/libs/{TinySmartScroller.cjs → html/scroll/TinySmartScroller.cjs} +4 -4
- package/dist/v1/libs/{TinySmartScroller.d.mts → html/scroll/TinySmartScroller.d.mts} +2 -2
- package/dist/v1/libs/html/scroll/TinySmartScroller.d.mts.map +1 -0
- package/dist/v1/libs/{TinySmartScroller.mjs → html/scroll/TinySmartScroller.mjs} +3 -3
- package/dist/v1/libs/{TinyAnalogClock.cjs → html/templates/TinyAnalogClock.cjs} +2 -2
- package/dist/v1/libs/html/templates/TinyAnalogClock.d.mts.map +1 -0
- package/dist/v1/libs/{TinyAnalogClock.mjs → html/templates/TinyAnalogClock.mjs} +1 -1
- package/dist/v1/libs/html/templates/TinyCookieConsent.d.mts.map +1 -0
- package/dist/v1/libs/html/templates/TinyLoadingScreen.d.mts.map +1 -0
- package/dist/v1/libs/{TinyUploadClicker.cjs → html/upload/TinyUploadClicker.cjs} +1 -10
- package/dist/v1/libs/{TinyUploadClicker.d.mts → html/upload/TinyUploadClicker.d.mts} +24 -24
- package/dist/v1/libs/html/upload/TinyUploadClicker.d.mts.map +1 -0
- package/dist/v1/libs/{TinyUploadClicker.mjs → html/upload/TinyUploadClicker.mjs} +1 -1
- package/dist/v1/libs/{TinyAdvancedRaffle.cjs → math/TinyAdvancedRaffle.cjs} +2 -2
- package/dist/v1/libs/math/TinyAdvancedRaffle.d.mts.map +1 -0
- package/dist/v1/libs/{TinyAdvancedRaffle.mjs → math/TinyAdvancedRaffle.mjs} +1 -1
- package/dist/v1/libs/math/TinyMamdaniInferenceSystem.d.mts.map +1 -0
- package/dist/v1/libs/{TinyRateLimiter.cjs → math/TinyRateLimiter.cjs} +2 -2
- package/dist/v1/libs/math/TinyRateLimiter.d.mts.map +1 -0
- package/dist/v1/libs/{TinyRateLimiter.mjs → math/TinyRateLimiter.mjs} +1 -1
- package/dist/v1/libs/{TinySimpleDice.cjs → math/TinySimpleDice.cjs} +1 -1
- package/dist/v1/libs/math/TinySimpleDice.d.mts.map +1 -0
- package/dist/v1/libs/{TinySimpleDice.mjs → math/TinySimpleDice.mjs} +1 -1
- package/dist/v1/libs/{TinyTimeout.cjs → math/TinyTimeout.cjs} +3 -3
- package/dist/v1/libs/math/TinyTimeout.d.mts.map +1 -0
- package/dist/v1/libs/{TinyTimeout.mjs → math/TinyTimeout.mjs} +2 -2
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/HtmlAudio.cjs +5 -5
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/HtmlAudio.d.mts +4 -4
- package/dist/v1/libs/media/TinyMediaPlayer/HtmlAudio.d.mts.map +1 -0
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/HtmlAudio.mjs +4 -4
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/HtmlVideo.cjs +5 -5
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/HtmlVideo.d.mts +4 -4
- package/dist/v1/libs/media/TinyMediaPlayer/HtmlVideo.d.mts.map +1 -0
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/HtmlVideo.mjs +4 -4
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/Mock.cjs +5 -5
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/Mock.d.mts +2 -2
- package/dist/v1/libs/media/TinyMediaPlayer/Mock.d.mts.map +1 -0
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/Mock.mjs +4 -4
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/SoundCloud.cjs +6 -6
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/SoundCloud.d.mts +4 -4
- package/dist/v1/libs/media/TinyMediaPlayer/SoundCloud.d.mts.map +1 -0
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/SoundCloud.mjs +5 -5
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/Youtube.cjs +6 -6
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/Youtube.d.mts +4 -4
- package/dist/v1/libs/media/TinyMediaPlayer/Youtube.d.mts.map +1 -0
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/Youtube.mjs +5 -5
- package/dist/v1/libs/media/TinyMediaPlayer/docs/SoundCloudWidget.d.mts.map +1 -0
- package/dist/v1/libs/media/TinyMediaPlayer/docs/YouTubePlayer.d.mts.map +1 -0
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/index.cjs +4 -4
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/index.d.mts +2 -2
- package/dist/v1/libs/media/TinyMediaPlayer/index.d.mts.map +1 -0
- package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/index.mjs +3 -3
- package/dist/v1/libs/{TinyMediaPlayer.cjs → media/TinyMediaPlayer.cjs} +13 -13
- package/dist/v1/libs/{TinyMediaPlayer.d.mts → media/TinyMediaPlayer.d.mts} +18 -18
- package/dist/v1/libs/media/TinyMediaPlayer.d.mts.map +1 -0
- package/dist/v1/libs/{TinyMediaPlayer.mjs → media/TinyMediaPlayer.mjs} +13 -13
- package/dist/v1/libs/{TinyRadioFm.cjs → media/TinyRadioFm.cjs} +15 -15
- package/dist/v1/libs/{TinyRadioFm.d.mts → media/TinyRadioFm.d.mts} +22 -22
- package/dist/v1/libs/media/TinyRadioFm.d.mts.map +1 -0
- package/dist/v1/libs/{TinyRadioFm.mjs → media/TinyRadioFm.mjs} +14 -14
- package/dist/v1/libs/{TinyLocalStorage.cjs → storage/TinyLocalStorage.cjs} +3 -3
- package/dist/v1/libs/storage/TinyLocalStorage.d.mts.map +1 -0
- package/dist/v1/libs/{TinyLocalStorage.mjs → storage/TinyLocalStorage.mjs} +2 -2
- package/dist/v1/libs/text/TinyClipboard.d.mts.map +1 -0
- package/dist/v1/libs/{TinyI18.cjs → text/TinyI18.cjs} +2 -2
- package/dist/v1/libs/text/TinyI18.d.mts.map +1 -0
- package/dist/v1/libs/{TinyI18.mjs → text/TinyI18.mjs} +1 -1
- package/dist/v1/libs/{TinyTextDiffer.cjs → text/TinyTextDiffer.cjs} +2 -2
- package/dist/v1/libs/text/TinyTextDiffer.d.mts.map +1 -0
- package/dist/v1/libs/{TinyTextDiffer.mjs → text/TinyTextDiffer.mjs} +1 -1
- package/dist/v1/libs/text/TinyTextRangeEditor.d.mts.map +1 -0
- package/dist/v1/libs/text/TinyTextarea.d.mts.map +1 -0
- package/dist/v1/libs/{TinyClassManager → tools/TinyClassManager}/TinyPluginInliner.cjs +1 -1
- package/dist/v1/libs/tools/TinyClassManager/TinyPluginInliner.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyClassManager.d.mts.map +1 -0
- package/dist/v1/libs/{TinyDebugger.cjs → tools/TinyDebugger.cjs} +2 -2
- package/dist/v1/libs/tools/TinyDebugger.d.mts.map +1 -0
- package/dist/v1/libs/{TinyDebugger.mjs → tools/TinyDebugger.mjs} +2 -2
- package/dist/v1/libs/tools/TinyPkgExportValidator.cjs +462 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts +104 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.mjs +407 -0
- package/dist/v1/libs/tools/examples/TinyClassManager.d.mts.map +1 -0
- package/dist/v1/libs/utils/TinyPromiseQueue.d.mts.map +1 -0
- package/dist/v1/libs/{UltraRandomMsgGen.cjs → utils/UltraRandomMsgGen.cjs} +2 -2
- package/dist/v1/libs/utils/UltraRandomMsgGen.d.mts.map +1 -0
- package/dist/v1/libs/{UltraRandomMsgGen.mjs → utils/UltraRandomMsgGen.mjs} +1 -1
- package/dist/v1/libs/{utils.d.mts → utils/tools.d.mts} +1 -1
- package/dist/v1/libs/utils/tools.d.mts.map +1 -0
- package/docs/TinyFork.md +2 -2
- package/docs/v1/Exports.md +130 -92
- package/docs/v1/README.md +102 -50
- package/docs/v1/basics/jsonFilter.md +194 -0
- package/docs/v1/libs/{TinyArrayComparator.md → array/TinyArrayComparator.md} +1 -1
- package/docs/v1/libs/{TinyArrayPaginator.md → array/TinyArrayPaginator.md} +1 -1
- package/docs/v1/libs/{ColorSafeStringify.md → color/ColorSafeStringify.md} +1 -1
- package/docs/v1/libs/{TinyLevelUp.md → game/TinyLevelUp.md} +1 -1
- package/docs/v1/libs/{TinyDomReadyManager.md → html/TinyDomReadyManager.md} +1 -1
- package/docs/v1/libs/{TinyElementObserver.md → html/TinyElementObserver.md} +1 -1
- package/docs/v1/libs/{TinyDragDropDetector.md → html/drag/TinyDragDropDetector.md} +1 -1
- package/docs/v1/libs/{TinyDragger.md → html/drag/TinyDragger.md} +1 -1
- package/docs/v1/libs/{TinyIframeEvents.md → html/events/TinyIframeEvents.md} +2 -2
- package/docs/v1/libs/{TinyNewWinEvents.md → html/events/TinyNewWinEvents.md} +2 -2
- package/docs/v1/libs/{TinyNotifications.md → html/notification/TinyNotifications.md} +1 -1
- package/docs/v1/libs/{TinyAfterScrollWatcher.md → html/scroll/TinyAfterScrollWatcher.md} +1 -1
- package/docs/v1/libs/{TinyAnalogClock.md → html/templates/TinyAnalogClock.md} +1 -1
- package/docs/v1/libs/{TinyCookieConsent.md → html/templates/TinyCookieConsent.md} +1 -1
- package/docs/v1/libs/{TinyLoadingScreen.md → html/templates/TinyLoadingScreen.md} +1 -1
- package/docs/v1/libs/{TinyMediaPlayer.md → media/TinyMediaPlayer.md} +8 -8
- package/docs/v1/libs/{TinyClipboard.md → text/TinyClipboard.md} +1 -1
- package/docs/v1/libs/{TinyTextDiffer.md → text/TinyTextDiffer.md} +1 -1
- package/docs/v1/libs/{TinyTextarea.md → text/TinyTextarea.md} +1 -1
- package/docs/v1/libs/{TinyClassManager → tools/TinyClassManager}/TinyPluginInliner.md +2 -2
- package/docs/v1/libs/{TinyClassManager.md → tools/TinyClassManager.md} +1 -1
- package/docs/v1/libs/{TinyDebugger.md → tools/TinyDebugger.md} +1 -1
- package/docs/v1/libs/tools/TinyPkgExportValidator.md +234 -0
- package/docs/v1/libs/{TinyPromiseQueue.md → utils/TinyPromiseQueue.md} +2 -2
- package/package.json +309 -303
- package/dist/v1/build/ColorSafeStringify.cjs +0 -7
- package/dist/v1/build/ColorSafeStringify.d.mts +0 -3
- package/dist/v1/build/ColorSafeStringify.mjs +0 -2
- package/dist/v1/build/TinyAdvancedRaffle.cjs +0 -7
- package/dist/v1/build/TinyAdvancedRaffle.d.mts +0 -3
- package/dist/v1/build/TinyAdvancedRaffle.mjs +0 -2
- package/dist/v1/build/TinyAfterScrollWatcher.cjs +0 -7
- package/dist/v1/build/TinyAfterScrollWatcher.d.mts +0 -3
- package/dist/v1/build/TinyAfterScrollWatcher.mjs +0 -2
- package/dist/v1/build/TinyAnalogClock.cjs +0 -7
- package/dist/v1/build/TinyAnalogClock.d.mts +0 -3
- package/dist/v1/build/TinyAnalogClock.mjs +0 -2
- package/dist/v1/build/TinyArrayComparator.cjs +0 -7
- package/dist/v1/build/TinyArrayComparator.d.mts +0 -3
- package/dist/v1/build/TinyArrayComparator.mjs +0 -2
- package/dist/v1/build/TinyArrayPaginator.cjs +0 -7
- package/dist/v1/build/TinyArrayPaginator.d.mts +0 -3
- package/dist/v1/build/TinyArrayPaginator.mjs +0 -2
- package/dist/v1/build/TinyClassManager.cjs +0 -7
- package/dist/v1/build/TinyClassManager.d.mts +0 -3
- package/dist/v1/build/TinyClassManager.mjs +0 -2
- package/dist/v1/build/TinyClipboard.cjs +0 -7
- package/dist/v1/build/TinyClipboard.d.mts +0 -3
- package/dist/v1/build/TinyClipboard.mjs +0 -2
- package/dist/v1/build/TinyColorConverter.cjs +0 -7
- package/dist/v1/build/TinyColorConverter.d.mts +0 -3
- package/dist/v1/build/TinyColorConverter.mjs +0 -2
- package/dist/v1/build/TinyColorValidator.cjs +0 -7
- package/dist/v1/build/TinyColorValidator.d.mts +0 -3
- package/dist/v1/build/TinyColorValidator.mjs +0 -2
- package/dist/v1/build/TinyCookieConsent.cjs +0 -7
- package/dist/v1/build/TinyCookieConsent.d.mts +0 -3
- package/dist/v1/build/TinyCookieConsent.mjs +0 -2
- package/dist/v1/build/TinyDayNightCycle.cjs +0 -7
- package/dist/v1/build/TinyDayNightCycle.d.mts +0 -3
- package/dist/v1/build/TinyDayNightCycle.mjs +0 -2
- package/dist/v1/build/TinyDebugger.cjs +0 -7
- package/dist/v1/build/TinyDebugger.d.mts +0 -3
- package/dist/v1/build/TinyDebugger.mjs +0 -2
- package/dist/v1/build/TinyDomReadyManager.cjs +0 -7
- package/dist/v1/build/TinyDomReadyManager.d.mts +0 -3
- package/dist/v1/build/TinyDomReadyManager.mjs +0 -2
- package/dist/v1/build/TinyDragDropDetector.cjs +0 -7
- package/dist/v1/build/TinyDragDropDetector.d.mts +0 -3
- package/dist/v1/build/TinyDragDropDetector.mjs +0 -2
- package/dist/v1/build/TinyDragger.cjs +0 -7
- package/dist/v1/build/TinyDragger.d.mts +0 -3
- package/dist/v1/build/TinyDragger.mjs +0 -2
- package/dist/v1/build/TinyElementObserver.cjs +0 -7
- package/dist/v1/build/TinyElementObserver.d.mts +0 -3
- package/dist/v1/build/TinyElementObserver.mjs +0 -2
- package/dist/v1/build/TinyGamepad.cjs +0 -7
- package/dist/v1/build/TinyGamepad.d.mts +0 -3
- package/dist/v1/build/TinyGamepad.mjs +0 -2
- package/dist/v1/build/TinyHtml.cjs +0 -7
- package/dist/v1/build/TinyHtml.d.mts +0 -3
- package/dist/v1/build/TinyHtml.mjs +0 -2
- package/dist/v1/build/TinyI18.cjs +0 -7
- package/dist/v1/build/TinyI18.d.mts +0 -3
- package/dist/v1/build/TinyI18.mjs +0 -2
- package/dist/v1/build/TinyIframeEvents.cjs +0 -7
- package/dist/v1/build/TinyIframeEvents.d.mts +0 -3
- package/dist/v1/build/TinyIframeEvents.mjs +0 -2
- package/dist/v1/build/TinyInventory.cjs +0 -7
- package/dist/v1/build/TinyInventory.d.mts +0 -3
- package/dist/v1/build/TinyInventory.mjs +0 -2
- package/dist/v1/build/TinyInventoryTrader.cjs +0 -7
- package/dist/v1/build/TinyInventoryTrader.d.mts +0 -3
- package/dist/v1/build/TinyInventoryTrader.mjs +0 -2
- package/dist/v1/build/TinyLevelUp.cjs +0 -7
- package/dist/v1/build/TinyLevelUp.d.mts +0 -3
- package/dist/v1/build/TinyLevelUp.mjs +0 -2
- package/dist/v1/build/TinyLoadingScreen.cjs +0 -7
- package/dist/v1/build/TinyLoadingScreen.d.mts +0 -3
- package/dist/v1/build/TinyLoadingScreen.mjs +0 -2
- package/dist/v1/build/TinyLocalStorage.cjs +0 -7
- package/dist/v1/build/TinyLocalStorage.d.mts +0 -3
- package/dist/v1/build/TinyLocalStorage.mjs +0 -2
- package/dist/v1/build/TinyMediaPlayer.cjs +0 -7
- package/dist/v1/build/TinyMediaPlayer.d.mts +0 -3
- package/dist/v1/build/TinyMediaPlayer.mjs +0 -2
- package/dist/v1/build/TinyNeedBar.cjs +0 -7
- package/dist/v1/build/TinyNeedBar.d.mts +0 -3
- package/dist/v1/build/TinyNeedBar.mjs +0 -2
- package/dist/v1/build/TinyNewWinEvents.cjs +0 -7
- package/dist/v1/build/TinyNewWinEvents.d.mts +0 -3
- package/dist/v1/build/TinyNewWinEvents.mjs +0 -2
- package/dist/v1/build/TinyNotifications.cjs +0 -7
- package/dist/v1/build/TinyNotifications.d.mts +0 -3
- package/dist/v1/build/TinyNotifications.mjs +0 -2
- package/dist/v1/build/TinyNotifyCenter.cjs +0 -7
- package/dist/v1/build/TinyNotifyCenter.d.mts +0 -3
- package/dist/v1/build/TinyNotifyCenter.mjs +0 -2
- package/dist/v1/build/TinyPromiseQueue.cjs +0 -7
- package/dist/v1/build/TinyPromiseQueue.d.mts +0 -3
- package/dist/v1/build/TinyPromiseQueue.mjs +0 -2
- package/dist/v1/build/TinyRadioFm.cjs +0 -7
- package/dist/v1/build/TinyRadioFm.d.mts +0 -3
- package/dist/v1/build/TinyRadioFm.mjs +0 -2
- package/dist/v1/build/TinyRateLimiter.cjs +0 -7
- package/dist/v1/build/TinyRateLimiter.d.mts +0 -3
- package/dist/v1/build/TinyRateLimiter.mjs +0 -2
- package/dist/v1/build/TinySimpleDice.cjs +0 -7
- package/dist/v1/build/TinySimpleDice.d.mts +0 -3
- package/dist/v1/build/TinySimpleDice.mjs +0 -2
- package/dist/v1/build/TinySmartScroller.cjs +0 -7
- package/dist/v1/build/TinySmartScroller.d.mts +0 -3
- package/dist/v1/build/TinySmartScroller.mjs +0 -2
- package/dist/v1/build/TinyTextDiffer.cjs +0 -7
- package/dist/v1/build/TinyTextDiffer.d.mts +0 -3
- package/dist/v1/build/TinyTextDiffer.mjs +0 -2
- package/dist/v1/build/TinyTextRangeEditor.cjs +0 -7
- package/dist/v1/build/TinyTextRangeEditor.d.mts +0 -3
- package/dist/v1/build/TinyTextRangeEditor.mjs +0 -2
- package/dist/v1/build/TinyTextarea.cjs +0 -7
- package/dist/v1/build/TinyTextarea.d.mts +0 -3
- package/dist/v1/build/TinyTextarea.mjs +0 -2
- package/dist/v1/build/TinyTimeout.cjs +0 -7
- package/dist/v1/build/TinyTimeout.d.mts +0 -3
- package/dist/v1/build/TinyTimeout.mjs +0 -2
- package/dist/v1/build/TinyToastNotify.cjs +0 -7
- package/dist/v1/build/TinyToastNotify.d.mts +0 -3
- package/dist/v1/build/TinyToastNotify.mjs +0 -2
- package/dist/v1/build/TinyUploadClicker.cjs +0 -7
- package/dist/v1/build/TinyUploadClicker.d.mts +0 -3
- package/dist/v1/build/TinyUploadClicker.mjs +0 -2
- package/dist/v1/build/UltraRandomMsgGen.cjs +0 -7
- package/dist/v1/build/UltraRandomMsgGen.d.mts +0 -3
- package/dist/v1/build/UltraRandomMsgGen.mjs +0 -2
- /package/dist/v1/libs/{TinyArrayComparator.cjs → array/TinyArrayComparator.cjs} +0 -0
- /package/dist/v1/libs/{TinyArrayComparator.d.mts → array/TinyArrayComparator.d.mts} +0 -0
- /package/dist/v1/libs/{TinyArrayComparator.mjs → array/TinyArrayComparator.mjs} +0 -0
- /package/dist/v1/libs/{TinyArrayPaginator.cjs → array/TinyArrayPaginator.cjs} +0 -0
- /package/dist/v1/libs/{TinyArrayPaginator.d.mts → array/TinyArrayPaginator.d.mts} +0 -0
- /package/dist/v1/libs/{TinyArrayPaginator.mjs → array/TinyArrayPaginator.mjs} +0 -0
- /package/dist/v1/libs/{ColorSafeStringify.cjs → color/ColorSafeStringify.cjs} +0 -0
- /package/dist/v1/libs/{ColorSafeStringify.d.mts → color/ColorSafeStringify.d.mts} +0 -0
- /package/dist/v1/libs/{ColorSafeStringify.mjs → color/ColorSafeStringify.mjs} +0 -0
- /package/dist/v1/libs/{TinyColorConverter.cjs → color/TinyColorConverter.cjs} +0 -0
- /package/dist/v1/libs/{TinyColorConverter.d.mts → color/TinyColorConverter.d.mts} +0 -0
- /package/dist/v1/libs/{TinyColorConverter.mjs → color/TinyColorConverter.mjs} +0 -0
- /package/dist/v1/libs/{TinyColorValidator.cjs → color/TinyColorValidator.cjs} +0 -0
- /package/dist/v1/libs/{TinyColorValidator.d.mts → color/TinyColorValidator.d.mts} +0 -0
- /package/dist/v1/libs/{TinyColorValidator.mjs → color/TinyColorValidator.mjs} +0 -0
- /package/dist/v1/libs/{TinyDayNightCycle.d.mts → game/TinyDayNightCycle.d.mts} +0 -0
- /package/dist/v1/libs/{TinyGamepad.d.mts → game/TinyGamepad.d.mts} +0 -0
- /package/dist/v1/libs/{TinyInventory.cjs → game/TinyInventory.cjs} +0 -0
- /package/dist/v1/libs/{TinyInventory.d.mts → game/TinyInventory.d.mts} +0 -0
- /package/dist/v1/libs/{TinyInventory.mjs → game/TinyInventory.mjs} +0 -0
- /package/dist/v1/libs/{TinyInventoryTrader.cjs → game/TinyInventoryTrader.cjs} +0 -0
- /package/dist/v1/libs/{TinyInventoryTrader.d.mts → game/TinyInventoryTrader.d.mts} +0 -0
- /package/dist/v1/libs/{TinyInventoryTrader.mjs → game/TinyInventoryTrader.mjs} +0 -0
- /package/dist/v1/libs/{TinyLevelUp.cjs → game/TinyLevelUp.cjs} +0 -0
- /package/dist/v1/libs/{TinyLevelUp.d.mts → game/TinyLevelUp.d.mts} +0 -0
- /package/dist/v1/libs/{TinyLevelUp.mjs → game/TinyLevelUp.mjs} +0 -0
- /package/dist/v1/libs/{TinyNeedBar.cjs → game/TinyNeedBar.cjs} +0 -0
- /package/dist/v1/libs/{TinyNeedBar.d.mts → game/TinyNeedBar.d.mts} +0 -0
- /package/dist/v1/libs/{TinyNeedBar.mjs → game/TinyNeedBar.mjs} +0 -0
- /package/dist/v1/libs/{TinyDomReadyManager.cjs → html/TinyDomReadyManager.cjs} +0 -0
- /package/dist/v1/libs/{TinyDomReadyManager.d.mts → html/TinyDomReadyManager.d.mts} +0 -0
- /package/dist/v1/libs/{TinyDomReadyManager.mjs → html/TinyDomReadyManager.mjs} +0 -0
- /package/dist/v1/libs/{TinyElementObserver.d.mts → html/TinyElementObserver.d.mts} +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlAnchor.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlAnchor.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlAnchor.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlButton.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlButton.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlButton.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlCanvas.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlCanvas.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlCanvas.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlDatalist.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlDatalist.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlDatalist.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlEmbed.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlEmbed.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlEmbed.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlForm.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlForm.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlForm.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlIcon.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlIcon.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlIcon.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlIframe.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlIframe.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlIframe.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlImage.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlImage.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlImage.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlLink.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlLink.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlLink.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlMedia.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlMedia.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlMedia.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlScript.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlScript.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlScript.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlSelect.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlSelect.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlSelect.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlStyle.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlStyle.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlStyle.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlTemplate.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlTemplate.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlTemplate.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlTextarea.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlTextarea.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/TinyHtmlTextarea.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/index.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/index.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/index.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlColorInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlColorInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlColorInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlFileInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlFileInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlFileInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlHiddenInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlHiddenInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlHiddenInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlImageInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlImageInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/TinyHtmlImageInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/button/TinyHtmlButtonInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/button/TinyHtmlButtonInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/button/TinyHtmlButtonInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/button/TinyHtmlResetInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/button/TinyHtmlResetInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/button/TinyHtmlResetInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/button/TinyHtmlSubmitInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/button/TinyHtmlSubmitInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/button/TinyHtmlSubmitInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/check/TinyHtmlCheckboxInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/check/TinyHtmlCheckboxInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/check/TinyHtmlCheckboxInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/check/TinyHtmlRadioInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/check/TinyHtmlRadioInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/check/TinyHtmlRadioInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlDateInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlDateInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlDateInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlDateTimeInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlDateTimeInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlDateTimeInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlMonthInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlMonthInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlMonthInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlTimeInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlTimeInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlTimeInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlWeekInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlWeekInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/date/TinyHtmlWeekInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/number/TinyHtmlNumberInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/number/TinyHtmlNumberInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/number/TinyHtmlNumberInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/number/TinyHtmlRangeInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/number/TinyHtmlRangeInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/number/TinyHtmlRangeInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlEmailInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlEmailInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlEmailInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlPasswordInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlPasswordInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlPasswordInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlSearchInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlSearchInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlSearchInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlTelInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlTelInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlTelInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlTextInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlTextInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlTextInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlUrlInput.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlUrlInput.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/input/text/TinyHtmlUrlInput.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlAudio.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlAudio.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlAudio.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlObject.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlObject.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlObject.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlSource.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlSource.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlSource.mjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlVideo.cjs +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlVideo.d.mts +0 -0
- /package/dist/v1/libs/{TinyHtml → html/TinyHtml}/media/TinyHtmlVideo.mjs +0 -0
- /package/dist/v1/libs/{TinyDragDropDetector.d.mts → html/drag/TinyDragDropDetector.d.mts} +0 -0
- /package/dist/v1/libs/{TinyIframeEvents.d.mts → html/events/TinyIframeEvents.d.mts} +0 -0
- /package/dist/v1/libs/{TinyNewWinEvents.d.mts → html/events/TinyNewWinEvents.d.mts} +0 -0
- /package/dist/v1/libs/{TinyNotifications.d.mts → html/notification/TinyNotifications.d.mts} +0 -0
- /package/dist/v1/libs/{TinyNotifyCenter.d.mts → html/notification/TinyNotifyCenter.d.mts} +0 -0
- /package/dist/v1/libs/{TinyToastNotify.d.mts → html/notification/TinyToastNotify.d.mts} +0 -0
- /package/dist/v1/libs/{TinyAfterScrollWatcher.d.mts → html/scroll/TinyAfterScrollWatcher.d.mts} +0 -0
- /package/dist/v1/libs/{TinyAnalogClock.d.mts → html/templates/TinyAnalogClock.d.mts} +0 -0
- /package/dist/v1/libs/{TinyCookieConsent.cjs → html/templates/TinyCookieConsent.cjs} +0 -0
- /package/dist/v1/libs/{TinyCookieConsent.d.mts → html/templates/TinyCookieConsent.d.mts} +0 -0
- /package/dist/v1/libs/{TinyCookieConsent.mjs → html/templates/TinyCookieConsent.mjs} +0 -0
- /package/dist/v1/libs/{TinyLoadingScreen.cjs → html/templates/TinyLoadingScreen.cjs} +0 -0
- /package/dist/v1/libs/{TinyLoadingScreen.d.mts → html/templates/TinyLoadingScreen.d.mts} +0 -0
- /package/dist/v1/libs/{TinyLoadingScreen.mjs → html/templates/TinyLoadingScreen.mjs} +0 -0
- /package/dist/v1/libs/{TinyAdvancedRaffle.d.mts → math/TinyAdvancedRaffle.d.mts} +0 -0
- /package/dist/v1/libs/{TinyMamdaniInferenceSystem.cjs → math/TinyMamdaniInferenceSystem.cjs} +0 -0
- /package/dist/v1/libs/{TinyMamdaniInferenceSystem.d.mts → math/TinyMamdaniInferenceSystem.d.mts} +0 -0
- /package/dist/v1/libs/{TinyMamdaniInferenceSystem.mjs → math/TinyMamdaniInferenceSystem.mjs} +0 -0
- /package/dist/v1/libs/{TinyRateLimiter.d.mts → math/TinyRateLimiter.d.mts} +0 -0
- /package/dist/v1/libs/{TinySimpleDice.d.mts → math/TinySimpleDice.d.mts} +0 -0
- /package/dist/v1/libs/{TinyTimeout.d.mts → math/TinyTimeout.d.mts} +0 -0
- /package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/docs/SoundCloudWidget.cjs +0 -0
- /package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/docs/SoundCloudWidget.d.mts +0 -0
- /package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/docs/SoundCloudWidget.mjs +0 -0
- /package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/docs/YouTubePlayer.cjs +0 -0
- /package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/docs/YouTubePlayer.d.mts +0 -0
- /package/dist/v1/libs/{TinyMediaPlayer → media/TinyMediaPlayer}/docs/YouTubePlayer.mjs +0 -0
- /package/dist/v1/libs/{TinyLocalStorage.d.mts → storage/TinyLocalStorage.d.mts} +0 -0
- /package/dist/v1/libs/{TinyClipboard.cjs → text/TinyClipboard.cjs} +0 -0
- /package/dist/v1/libs/{TinyClipboard.d.mts → text/TinyClipboard.d.mts} +0 -0
- /package/dist/v1/libs/{TinyClipboard.mjs → text/TinyClipboard.mjs} +0 -0
- /package/dist/v1/libs/{TinyI18.d.mts → text/TinyI18.d.mts} +0 -0
- /package/dist/v1/libs/{TinyTextDiffer.d.mts → text/TinyTextDiffer.d.mts} +0 -0
- /package/dist/v1/libs/{TinyTextRangeEditor.cjs → text/TinyTextRangeEditor.cjs} +0 -0
- /package/dist/v1/libs/{TinyTextRangeEditor.d.mts → text/TinyTextRangeEditor.d.mts} +0 -0
- /package/dist/v1/libs/{TinyTextRangeEditor.mjs → text/TinyTextRangeEditor.mjs} +0 -0
- /package/dist/v1/libs/{TinyTextarea.cjs → text/TinyTextarea.cjs} +0 -0
- /package/dist/v1/libs/{TinyTextarea.d.mts → text/TinyTextarea.d.mts} +0 -0
- /package/dist/v1/libs/{TinyTextarea.mjs → text/TinyTextarea.mjs} +0 -0
- /package/dist/v1/libs/{TinyClassManager → tools/TinyClassManager}/TinyPluginInliner.d.mts +0 -0
- /package/dist/v1/libs/{TinyClassManager → tools/TinyClassManager}/TinyPluginInliner.mjs +0 -0
- /package/dist/v1/libs/{TinyClassManager.cjs → tools/TinyClassManager.cjs} +0 -0
- /package/dist/v1/libs/{TinyClassManager.d.mts → tools/TinyClassManager.d.mts} +0 -0
- /package/dist/v1/libs/{TinyClassManager.mjs → tools/TinyClassManager.mjs} +0 -0
- /package/dist/v1/libs/{TinyDebugger.d.mts → tools/TinyDebugger.d.mts} +0 -0
- /package/dist/v1/libs/{examples → tools/examples}/TinyClassManager.cjs +0 -0
- /package/dist/v1/libs/{examples → tools/examples}/TinyClassManager.d.mts +0 -0
- /package/dist/v1/libs/{examples → tools/examples}/TinyClassManager.mjs +0 -0
- /package/dist/v1/libs/{TinyPromiseQueue.cjs → utils/TinyPromiseQueue.cjs} +0 -0
- /package/dist/v1/libs/{TinyPromiseQueue.d.mts → utils/TinyPromiseQueue.d.mts} +0 -0
- /package/dist/v1/libs/{TinyPromiseQueue.mjs → utils/TinyPromiseQueue.mjs} +0 -0
- /package/dist/v1/libs/{UltraRandomMsgGen.d.mts → utils/UltraRandomMsgGen.d.mts} +0 -0
- /package/dist/v1/libs/{utils.cjs → utils/tools.cjs} +0 -0
- /package/dist/v1/libs/{utils.mjs → utils/tools.mjs} +0 -0
- /package/docs/v1/libs/{TinyColorConverter.md → color/TinyColorConverter.md} +0 -0
- /package/docs/v1/libs/{TinyColorValidator.md → color/TinyColorValidator.md} +0 -0
- /package/docs/v1/libs/{TinyDayNightCycle.md → game/TinyDayNightCycle.md} +0 -0
- /package/docs/v1/libs/{TinyGamepad.md → game/TinyGamepad.md} +0 -0
- /package/docs/v1/libs/{TinyInventory.md → game/TinyInventory.md} +0 -0
- /package/docs/v1/libs/{TinyInventoryTrader.md → game/TinyInventoryTrader.md} +0 -0
- /package/docs/v1/libs/{TinyNeedBar.md → game/TinyNeedBar.md} +0 -0
- /package/docs/v1/libs/{TinyHtml.md → html/TinyHtml.md} +0 -0
- /package/docs/v1/libs/{TinyHtmlTips.md → html/TinyHtmlTips.md} +0 -0
- /package/docs/v1/libs/{TinyNotifyCenter.md → html/notification/TinyNotifyCenter.md} +0 -0
- /package/docs/v1/libs/{TinyToastNotify.md → html/notification/TinyToastNotify.md} +0 -0
- /package/docs/v1/libs/{TinySmartScroller.md → html/scroll/TinySmartScroller.md} +0 -0
- /package/docs/v1/libs/{TinyUploadClicker.md → html/upload/TinyUploadClicker.md} +0 -0
- /package/docs/v1/libs/{TinyAdvancedRaffle.md → math/TinyAdvancedRaffle.md} +0 -0
- /package/docs/v1/libs/{TinyMamdaniInferenceSystem.md → math/TinyMamdaniInferenceSystem.md} +0 -0
- /package/docs/v1/libs/{TinyRateLimiter.md → math/TinyRateLimiter.md} +0 -0
- /package/docs/v1/libs/{TinySimpleDice.md → math/TinySimpleDice.md} +0 -0
- /package/docs/v1/libs/{TinyTimeout.md → math/TinyTimeout.md} +0 -0
- /package/docs/v1/libs/{TinyRadioFm.md → media/TinyRadioFm.md} +0 -0
- /package/docs/v1/libs/{TinyLocalStorage.md → storage/TinyLocalStorage.md} +0 -0
- /package/docs/v1/libs/{TinyI18.md → text/TinyI18.md} +0 -0
- /package/docs/v1/libs/{TinyTextRangeEditor.md → text/TinyTextRangeEditor.md} +0 -0
- /package/docs/v1/libs/{UltraRandomMsgGen.md → utils/UltraRandomMsgGen.md} +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var objChecker = require('./objChecker.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a valid key for an object, which can be a string, number, or symbol.
|
|
7
|
+
* @typedef {string|number|symbol} RecordKey
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A predicate function used to filter object entries. It receives the current entry as a [key, value] tuple,
|
|
12
|
+
* the current index, and the array of all entries. It must act as a type guard to ensure the entry maintains the
|
|
13
|
+
* correct tuple structure.
|
|
14
|
+
*
|
|
15
|
+
* @template T
|
|
16
|
+
* @typedef {(
|
|
17
|
+
* entry: [keyof T, T[keyof T]],
|
|
18
|
+
* index: number,
|
|
19
|
+
* array: [keyof T, T[keyof T]][]
|
|
20
|
+
* ) => entry is [keyof T, T[keyof T]]} JsonFilterCallback
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @template {Record<any, any>} T
|
|
25
|
+
* @param {T} value - The source object to be filtered.
|
|
26
|
+
* @param {JsonFilterCallback<T>} filterContent - Predicate function used to filter the object's entries.
|
|
27
|
+
* @returns {Partial<T>} - A new object containing a subset of the original object's keys.
|
|
28
|
+
* @throws {TypeError} If the value is not a non-null object or filterContent is not a function.
|
|
29
|
+
*/
|
|
30
|
+
function jsonFilter(value, filterContent) {
|
|
31
|
+
// Argument validation
|
|
32
|
+
if (!objChecker.isValidObj(value)) {
|
|
33
|
+
throw new TypeError('The first argument must be a non-null object.');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (typeof filterContent !== 'function') {
|
|
37
|
+
throw new TypeError('The second argument must be a function.');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const filtered = Object.entries(value).filter(filterContent);
|
|
41
|
+
|
|
42
|
+
// We use a type cast here because Object.fromEntries returns { [k: string]: any }
|
|
43
|
+
// which is too broad to be automatically assigned to Partial<T>.
|
|
44
|
+
return /** @type {Partial<T>} */ (Object.fromEntries(filtered));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A predicate function used to determine whether an element should be included in the filtered result.
|
|
49
|
+
*
|
|
50
|
+
* @template T
|
|
51
|
+
* @callback BasePredicate
|
|
52
|
+
* @param {T} current - The current element being evaluated. Depending on the recursion level, this can be an entry tuple `[key, value]`, a primitive value, or a nested object.
|
|
53
|
+
* @param {number} index - The zero-based index of the current element within the array being iterated.
|
|
54
|
+
* @param {any[]} array - The array containing the current element.
|
|
55
|
+
* @returns {boolean} True if the element satisfies the condition and should be kept; otherwise, false.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Configuration object for the `jsonFilterRecursive` function, containing predicate functions for different data types.
|
|
60
|
+
*
|
|
61
|
+
* @typedef {Object} FilterOptions
|
|
62
|
+
* @property {BasePredicate<[any, any]>} [value] - A predicate function applied to primitive values. Receives the entry as a `[key, value]` tuple.
|
|
63
|
+
* @property {BasePredicate<Record<any, any> | Map<any, any> | Set<any>>} [obj] - A predicate function applied to nested objects, Maps, or Sets. Receives the filtered sub-structure as its first argument.
|
|
64
|
+
* @property {BasePredicate<[any, any]>} [array] - A predicate function applied to array elements. Receives the entry as a `[key, value]` tuple.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Recursively traverses an object and returns a new structure containing only the elements
|
|
69
|
+
* that satisfy the provided filtering criteria.
|
|
70
|
+
*
|
|
71
|
+
* The function applies specific predicates based on the type of the current value:
|
|
72
|
+
* 1. If the value is an Array, the `filter.array` predicate is applied.
|
|
73
|
+
* 2. If the value is a Map or Set, the recursion occurs, and then the `filter.obj` predicate is applied to the result.
|
|
74
|
+
* 3. If the value is an Object, the function recurses, and then the `filter.obj` predicate is applied to the result.
|
|
75
|
+
* 4. If the value is a primitive, the `filter.value` predicate is applied.
|
|
76
|
+
*
|
|
77
|
+
* @template {Record<any, any>} T
|
|
78
|
+
* @param {T} value - The source object to be deeply filtered.
|
|
79
|
+
* @param {FilterOptions} filter - An object containing optional predicate functions for different data types.
|
|
80
|
+
* @returns {Partial<T>} A new, deeply filtered version of the original object.
|
|
81
|
+
* @throws {TypeError} If `filter.obj`, `filter.value`, or `filter.array` are provided but are not functions.
|
|
82
|
+
*/
|
|
83
|
+
function jsonFilterRecursive(value, filter) {
|
|
84
|
+
// Validation for optional functional arguments
|
|
85
|
+
if (filter.obj !== undefined && typeof filter.obj !== 'function') {
|
|
86
|
+
throw new TypeError('filter.obj must be a function if provided.');
|
|
87
|
+
}
|
|
88
|
+
if (filter.value !== undefined && typeof filter.value !== 'function') {
|
|
89
|
+
throw new TypeError('filter.value must be a function if provided.');
|
|
90
|
+
}
|
|
91
|
+
if (filter.array !== undefined && typeof filter.array !== 'function') {
|
|
92
|
+
throw new TypeError('filter.array must be a function if provided.');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Initialize the result container based on the input type
|
|
96
|
+
let result;
|
|
97
|
+
if (value instanceof Map) {
|
|
98
|
+
result = new Map();
|
|
99
|
+
} else if (value instanceof Set) {
|
|
100
|
+
result = new Set();
|
|
101
|
+
} else {
|
|
102
|
+
result = {};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Helper to get entries for different types
|
|
107
|
+
* @param {Record<any, any>|Map<any, any>|Set<any>} obj
|
|
108
|
+
*/
|
|
109
|
+
const getEntries = (obj) => {
|
|
110
|
+
if (obj instanceof Map) return Array.from(obj.entries());
|
|
111
|
+
if (obj instanceof Set) return Array.from(obj.values()).map((v) => [undefined, v]);
|
|
112
|
+
return Object.entries(obj);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const entries = getEntries(value);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Helper function to recursively reconstruct and filter arrays
|
|
119
|
+
* @param {any[]} arr
|
|
120
|
+
* @param {any} key
|
|
121
|
+
* @returns {any[]}
|
|
122
|
+
*/
|
|
123
|
+
const processArray = (arr, key) => {
|
|
124
|
+
const newArr = [];
|
|
125
|
+
for (let i = 0; i < arr.length; i++) {
|
|
126
|
+
const arrValue = arr[i];
|
|
127
|
+
|
|
128
|
+
// Case 1: Value is an Array
|
|
129
|
+
if (Array.isArray(arrValue)) {
|
|
130
|
+
newArr.push(processArray(arrValue, key));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Case 2: Value is an Object, Map, or Set
|
|
134
|
+
else if (objChecker.isValidObj(arrValue)) {
|
|
135
|
+
const d = jsonFilterRecursive(arrValue, filter);
|
|
136
|
+
if (typeof filter.obj !== 'undefined' ? filter.obj(d, i, arr) : true) {
|
|
137
|
+
newArr.push(d);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Case 3: Value is a primitive/other
|
|
142
|
+
else {
|
|
143
|
+
if (typeof filter.value !== 'undefined' ? filter.value([key, arrValue], i, arr) : true) {
|
|
144
|
+
newArr.push(arrValue);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return newArr;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Main loop to build the new structure
|
|
152
|
+
for (let index = 0; index < entries.length; index++) {
|
|
153
|
+
const [key, val] = entries[index];
|
|
154
|
+
|
|
155
|
+
// Case 1: Value is an Array
|
|
156
|
+
if (Array.isArray(val)) {
|
|
157
|
+
const newArr = processArray(val, key);
|
|
158
|
+
const shouldKeep =
|
|
159
|
+
typeof filter.array !== 'undefined' ? filter.array([key, newArr], index, entries) : true;
|
|
160
|
+
|
|
161
|
+
if (shouldKeep) {
|
|
162
|
+
if (result instanceof Map || result instanceof Set) {
|
|
163
|
+
// This part handles if the root itself was a Map/Set
|
|
164
|
+
if (result instanceof Map) result.set(key, newArr);
|
|
165
|
+
else result.add(newArr);
|
|
166
|
+
} else {
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
result[key] = newArr;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// Case 2: Value is an Object, Map, or Set
|
|
173
|
+
else if (objChecker.isValidObj(val)) {
|
|
174
|
+
const d = jsonFilterRecursive(val, filter);
|
|
175
|
+
const shouldKeep = typeof filter.obj !== 'undefined' ? filter.obj(d, index, entries) : true;
|
|
176
|
+
|
|
177
|
+
if (shouldKeep) {
|
|
178
|
+
if (result instanceof Map) {
|
|
179
|
+
result.set(key, d);
|
|
180
|
+
} else if (result instanceof Set) {
|
|
181
|
+
result.add(d);
|
|
182
|
+
} else {
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
result[key] = d;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Case 3: Value is a primitive/other
|
|
189
|
+
else {
|
|
190
|
+
const shouldKeep =
|
|
191
|
+
typeof filter.value !== 'undefined' ? filter.value([key, val], index, entries) : true;
|
|
192
|
+
|
|
193
|
+
if (shouldKeep) {
|
|
194
|
+
if (result instanceof Map) {
|
|
195
|
+
result.set(key, val);
|
|
196
|
+
} else if (result instanceof Set) {
|
|
197
|
+
result.add(val);
|
|
198
|
+
} else {
|
|
199
|
+
// @ts-ignore
|
|
200
|
+
result[key] = val;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// We use a type cast here because TypeScript infers `result` as `any` initially.
|
|
207
|
+
return /** @type {Partial<T>} */ (result);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* A predicate function used to validate whether a given value satisfies a specific condition or type requirement.
|
|
212
|
+
* @typedef {(value: any) => boolean} ValueTypeValidator
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @template {Record<any, any>} T
|
|
217
|
+
* @param {T} item - The source object to be filtered.
|
|
218
|
+
* @param {(RecordKey|[any, any|ValueTypeValidator])[]} keys - An array of keys or [key, value/validator] tuples to keep.
|
|
219
|
+
* @param {(any|ValueTypeValidator)[]} [values] - An array of values or validators to validate against when using simple keys.
|
|
220
|
+
* @returns {Partial<T>} - A new object containing only the specified keys.
|
|
221
|
+
* @throws {TypeError} If the item is not a non-null object, keys is not an array, or values is not an array.
|
|
222
|
+
*/
|
|
223
|
+
function jsonFilterByKeys(item, keys, values) {
|
|
224
|
+
if (!Array.isArray(keys)) {
|
|
225
|
+
throw new TypeError('The second argument must be an array.');
|
|
226
|
+
}
|
|
227
|
+
if (typeof values !== 'undefined' && !Array.isArray(values)) {
|
|
228
|
+
throw new TypeError('The third argument must be an array.');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return jsonFilter(
|
|
232
|
+
item,
|
|
233
|
+
// @ts-ignore
|
|
234
|
+
([key, value]) => {
|
|
235
|
+
if (keys.length > 0)
|
|
236
|
+
return keys.some((k) => {
|
|
237
|
+
// Case 1: The element in 'keys' is a tuple [targetKey, targetValueOrValidator]
|
|
238
|
+
if (Array.isArray(k)) {
|
|
239
|
+
const [targetKey, targetValue] = k;
|
|
240
|
+
const keyMatches = key === targetKey;
|
|
241
|
+
const valueMatches =
|
|
242
|
+
typeof targetValue === 'function' ? targetValue(value) : value === targetValue;
|
|
243
|
+
|
|
244
|
+
return keyMatches && valueMatches;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Case 2: The element in 'keys' is a simple key
|
|
248
|
+
const keyMatches = key === k;
|
|
249
|
+
|
|
250
|
+
// Universal validation: check if value is in 'values' OR matches a validator in 'values'
|
|
251
|
+
const valueMatches =
|
|
252
|
+
typeof values === 'undefined' ||
|
|
253
|
+
values.some((v) => (typeof v === 'function' ? v(value) : v === value));
|
|
254
|
+
|
|
255
|
+
return keyMatches && valueMatches;
|
|
256
|
+
});
|
|
257
|
+
// Universal validation: check if value is in 'values' OR matches a validator in 'values'
|
|
258
|
+
if (typeof values !== 'undefined')
|
|
259
|
+
return values.some((v) => (typeof v === 'function' ? v(value) : v === value));
|
|
260
|
+
return false;
|
|
261
|
+
},
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
exports.jsonFilter = jsonFilter;
|
|
266
|
+
exports.jsonFilterByKeys = jsonFilterByKeys;
|
|
267
|
+
exports.jsonFilterRecursive = jsonFilterRecursive;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export type RecordKey = string | number | symbol;
|
|
2
|
+
export type JsonFilterCallback<T> = (entry: [keyof T, T[keyof T]], index: number, array: [keyof T, T[keyof T]][]) => entry is [keyof T, T[keyof T]];
|
|
3
|
+
/**
|
|
4
|
+
* Represents a valid key for an object, which can be a string, number, or symbol.
|
|
5
|
+
* @typedef {string|number|symbol} RecordKey
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A predicate function used to filter object entries. It receives the current entry as a [key, value] tuple,
|
|
9
|
+
* the current index, and the array of all entries. It must act as a type guard to ensure the entry maintains the
|
|
10
|
+
* correct tuple structure.
|
|
11
|
+
*
|
|
12
|
+
* @template T
|
|
13
|
+
* @typedef {(
|
|
14
|
+
* entry: [keyof T, T[keyof T]],
|
|
15
|
+
* index: number,
|
|
16
|
+
* array: [keyof T, T[keyof T]][]
|
|
17
|
+
* ) => entry is [keyof T, T[keyof T]]} JsonFilterCallback
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* @template {Record<any, any>} T
|
|
21
|
+
* @param {T} value - The source object to be filtered.
|
|
22
|
+
* @param {JsonFilterCallback<T>} filterContent - Predicate function used to filter the object's entries.
|
|
23
|
+
* @returns {Partial<T>} - A new object containing a subset of the original object's keys.
|
|
24
|
+
* @throws {TypeError} If the value is not a non-null object or filterContent is not a function.
|
|
25
|
+
*/
|
|
26
|
+
export declare function jsonFilter<T extends Record<any, any>>(value: T, filterContent: JsonFilterCallback<T>): Partial<T>;
|
|
27
|
+
export type BasePredicate<T> = (current: T, index: number, array: any[]) => boolean;
|
|
28
|
+
export type FilterOptions = {
|
|
29
|
+
/**
|
|
30
|
+
* - A predicate function applied to primitive values. Receives the entry as a `[key, value]` tuple.
|
|
31
|
+
*/
|
|
32
|
+
value?: BasePredicate<[any, any]>;
|
|
33
|
+
/**
|
|
34
|
+
* - A predicate function applied to nested objects, Maps, or Sets. Receives the filtered sub-structure as its first argument.
|
|
35
|
+
*/
|
|
36
|
+
obj?: BasePredicate<Record<any, any> | Map<any, any> | Set<any>>;
|
|
37
|
+
/**
|
|
38
|
+
* - A predicate function applied to array elements. Receives the entry as a `[key, value]` tuple.
|
|
39
|
+
*/
|
|
40
|
+
array?: BasePredicate<[any, any]>;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A predicate function used to determine whether an element should be included in the filtered result.
|
|
44
|
+
*
|
|
45
|
+
* @template T
|
|
46
|
+
* @callback BasePredicate
|
|
47
|
+
* @param {T} current - The current element being evaluated. Depending on the recursion level, this can be an entry tuple `[key, value]`, a primitive value, or a nested object.
|
|
48
|
+
* @param {number} index - The zero-based index of the current element within the array being iterated.
|
|
49
|
+
* @param {any[]} array - The array containing the current element.
|
|
50
|
+
* @returns {boolean} True if the element satisfies the condition and should be kept; otherwise, false.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Configuration object for the `jsonFilterRecursive` function, containing predicate functions for different data types.
|
|
54
|
+
*
|
|
55
|
+
* @typedef {Object} FilterOptions
|
|
56
|
+
* @property {BasePredicate<[any, any]>} [value] - A predicate function applied to primitive values. Receives the entry as a `[key, value]` tuple.
|
|
57
|
+
* @property {BasePredicate<Record<any, any> | Map<any, any> | Set<any>>} [obj] - A predicate function applied to nested objects, Maps, or Sets. Receives the filtered sub-structure as its first argument.
|
|
58
|
+
* @property {BasePredicate<[any, any]>} [array] - A predicate function applied to array elements. Receives the entry as a `[key, value]` tuple.
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* Recursively traverses an object and returns a new structure containing only the elements
|
|
62
|
+
* that satisfy the provided filtering criteria.
|
|
63
|
+
*
|
|
64
|
+
* The function applies specific predicates based on the type of the current value:
|
|
65
|
+
* 1. If the value is an Array, the `filter.array` predicate is applied.
|
|
66
|
+
* 2. If the value is a Map or Set, the recursion occurs, and then the `filter.obj` predicate is applied to the result.
|
|
67
|
+
* 3. If the value is an Object, the function recurses, and then the `filter.obj` predicate is applied to the result.
|
|
68
|
+
* 4. If the value is a primitive, the `filter.value` predicate is applied.
|
|
69
|
+
*
|
|
70
|
+
* @template {Record<any, any>} T
|
|
71
|
+
* @param {T} value - The source object to be deeply filtered.
|
|
72
|
+
* @param {FilterOptions} filter - An object containing optional predicate functions for different data types.
|
|
73
|
+
* @returns {Partial<T>} A new, deeply filtered version of the original object.
|
|
74
|
+
* @throws {TypeError} If `filter.obj`, `filter.value`, or `filter.array` are provided but are not functions.
|
|
75
|
+
*/
|
|
76
|
+
export declare function jsonFilterRecursive<T extends Record<any, any>>(value: T, filter: FilterOptions): Partial<T>;
|
|
77
|
+
export type ValueTypeValidator = (value: any) => boolean;
|
|
78
|
+
/**
|
|
79
|
+
* A predicate function used to validate whether a given value satisfies a specific condition or type requirement.
|
|
80
|
+
* @typedef {(value: any) => boolean} ValueTypeValidator
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* @template {Record<any, any>} T
|
|
84
|
+
* @param {T} item - The source object to be filtered.
|
|
85
|
+
* @param {(RecordKey|[any, any|ValueTypeValidator])[]} keys - An array of keys or [key, value/validator] tuples to keep.
|
|
86
|
+
* @param {(any|ValueTypeValidator)[]} [values] - An array of values or validators to validate against when using simple keys.
|
|
87
|
+
* @returns {Partial<T>} - A new object containing only the specified keys.
|
|
88
|
+
* @throws {TypeError} If the item is not a non-null object, keys is not an array, or values is not an array.
|
|
89
|
+
*/
|
|
90
|
+
export declare function jsonFilterByKeys<T extends Record<any, any>>(item: T, keys: (RecordKey | [any, any | ValueTypeValidator])[], values?: (any | ValueTypeValidator)[]): Partial<T>;
|
|
91
|
+
//# sourceMappingURL=jsonFilter.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonFilter.d.mts","sourceRoot":"","sources":["../../../src/v1/basics/jsonFilter.mjs"],"names":[],"mappings":"AAIG,YAAgC,SAAS,GAA/B,MAAM,GAAC,MAAM,GAAC,MAAM,CAAW;AASzC,YAIqC,kBAAkB,CAL7C,CAAC,IACD,CACR,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAC3B,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAoB;AAf1D;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;GAMG;AACH,wBAAgB,UAAU,CANM,CAAC,SAAnB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAI,EAMN,KAAK,EALrB,CAKqB,EAAE,aAAa,EAJpC,kBAAkB,CAAC,CAAC,CAIgB,GAHlC,OAAO,CAAC,CAAC,CAAC,CAkBtB;AAME,YAAU,aAAa,CADb,CAAC,IAEX,CAAW,OAAO,EAAV,CACR,EAAgB,KAAK,EAAb,MACR,EAAe,KAAK,EAAZ,GAAG,EACX,KAAU,OACZ,CAAA;AAKE,YAAkB,aAAa,GAC/B;;;;IAAuC,KAAK,AAA5C,CACA,EADW,aAAa,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CACpC;;;;IAAwE,GAAG,AAA3E,CACA,EADW,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CACrE;;;;IAAuC,KAAK,AAA5C,CACF,EADa,aAAa,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CACtC;CAAA,CAAA;AAlBD;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CANH,CAAC,SAAnB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAI,EAMG,KAAK,EAL9B,CAK8B,EAAE,MAAM,EAJtC,aAIsC,GAHpC,OAAO,CAAC,CAAC,CAAC,CAgItB;AAIE,YAAmC,kBAAkB,GAA3C,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAoB;AAFxD;;;GAGG;AAEH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAPA,CAAC,SAAnB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAI,EAOA,IAAI,EAN1B,CAM0B,EAAE,IAAI,EALhC,CAAC,SAAS,GAAC,CAAC,GAAG,EAAE,GAAG,GAAC,kBAAkB,CAAC,CAAC,EAKT,EAAE,MAAM,AAJhD,CACA,EADQ,CAAC,GAAG,GAAC,kBAAkB,CAAC,EAIgB,GAHtC,OAAO,CAAC,CAAC,CAAC,CA2CtB"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { isValidObj } from './objChecker.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a valid key for an object, which can be a string, number, or symbol.
|
|
4
|
+
* @typedef {string|number|symbol} RecordKey
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A predicate function used to filter object entries. It receives the current entry as a [key, value] tuple,
|
|
8
|
+
* the current index, and the array of all entries. It must act as a type guard to ensure the entry maintains the
|
|
9
|
+
* correct tuple structure.
|
|
10
|
+
*
|
|
11
|
+
* @template T
|
|
12
|
+
* @typedef {(
|
|
13
|
+
* entry: [keyof T, T[keyof T]],
|
|
14
|
+
* index: number,
|
|
15
|
+
* array: [keyof T, T[keyof T]][]
|
|
16
|
+
* ) => entry is [keyof T, T[keyof T]]} JsonFilterCallback
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* @template {Record<any, any>} T
|
|
20
|
+
* @param {T} value - The source object to be filtered.
|
|
21
|
+
* @param {JsonFilterCallback<T>} filterContent - Predicate function used to filter the object's entries.
|
|
22
|
+
* @returns {Partial<T>} - A new object containing a subset of the original object's keys.
|
|
23
|
+
* @throws {TypeError} If the value is not a non-null object or filterContent is not a function.
|
|
24
|
+
*/
|
|
25
|
+
export function jsonFilter(value, filterContent) {
|
|
26
|
+
// Argument validation
|
|
27
|
+
if (!isValidObj(value)) {
|
|
28
|
+
throw new TypeError('The first argument must be a non-null object.');
|
|
29
|
+
}
|
|
30
|
+
if (typeof filterContent !== 'function') {
|
|
31
|
+
throw new TypeError('The second argument must be a function.');
|
|
32
|
+
}
|
|
33
|
+
const filtered = Object.entries(value).filter(filterContent);
|
|
34
|
+
// We use a type cast here because Object.fromEntries returns { [k: string]: any }
|
|
35
|
+
// which is too broad to be automatically assigned to Partial<T>.
|
|
36
|
+
return /** @type {Partial<T>} */ (Object.fromEntries(filtered));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A predicate function used to determine whether an element should be included in the filtered result.
|
|
40
|
+
*
|
|
41
|
+
* @template T
|
|
42
|
+
* @callback BasePredicate
|
|
43
|
+
* @param {T} current - The current element being evaluated. Depending on the recursion level, this can be an entry tuple `[key, value]`, a primitive value, or a nested object.
|
|
44
|
+
* @param {number} index - The zero-based index of the current element within the array being iterated.
|
|
45
|
+
* @param {any[]} array - The array containing the current element.
|
|
46
|
+
* @returns {boolean} True if the element satisfies the condition and should be kept; otherwise, false.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Configuration object for the `jsonFilterRecursive` function, containing predicate functions for different data types.
|
|
50
|
+
*
|
|
51
|
+
* @typedef {Object} FilterOptions
|
|
52
|
+
* @property {BasePredicate<[any, any]>} [value] - A predicate function applied to primitive values. Receives the entry as a `[key, value]` tuple.
|
|
53
|
+
* @property {BasePredicate<Record<any, any> | Map<any, any> | Set<any>>} [obj] - A predicate function applied to nested objects, Maps, or Sets. Receives the filtered sub-structure as its first argument.
|
|
54
|
+
* @property {BasePredicate<[any, any]>} [array] - A predicate function applied to array elements. Receives the entry as a `[key, value]` tuple.
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* Recursively traverses an object and returns a new structure containing only the elements
|
|
58
|
+
* that satisfy the provided filtering criteria.
|
|
59
|
+
*
|
|
60
|
+
* The function applies specific predicates based on the type of the current value:
|
|
61
|
+
* 1. If the value is an Array, the `filter.array` predicate is applied.
|
|
62
|
+
* 2. If the value is a Map or Set, the recursion occurs, and then the `filter.obj` predicate is applied to the result.
|
|
63
|
+
* 3. If the value is an Object, the function recurses, and then the `filter.obj` predicate is applied to the result.
|
|
64
|
+
* 4. If the value is a primitive, the `filter.value` predicate is applied.
|
|
65
|
+
*
|
|
66
|
+
* @template {Record<any, any>} T
|
|
67
|
+
* @param {T} value - The source object to be deeply filtered.
|
|
68
|
+
* @param {FilterOptions} filter - An object containing optional predicate functions for different data types.
|
|
69
|
+
* @returns {Partial<T>} A new, deeply filtered version of the original object.
|
|
70
|
+
* @throws {TypeError} If `filter.obj`, `filter.value`, or `filter.array` are provided but are not functions.
|
|
71
|
+
*/
|
|
72
|
+
export function jsonFilterRecursive(value, filter) {
|
|
73
|
+
// Validation for optional functional arguments
|
|
74
|
+
if (filter.obj !== undefined && typeof filter.obj !== 'function') {
|
|
75
|
+
throw new TypeError('filter.obj must be a function if provided.');
|
|
76
|
+
}
|
|
77
|
+
if (filter.value !== undefined && typeof filter.value !== 'function') {
|
|
78
|
+
throw new TypeError('filter.value must be a function if provided.');
|
|
79
|
+
}
|
|
80
|
+
if (filter.array !== undefined && typeof filter.array !== 'function') {
|
|
81
|
+
throw new TypeError('filter.array must be a function if provided.');
|
|
82
|
+
}
|
|
83
|
+
// Initialize the result container based on the input type
|
|
84
|
+
let result;
|
|
85
|
+
if (value instanceof Map) {
|
|
86
|
+
result = new Map();
|
|
87
|
+
}
|
|
88
|
+
else if (value instanceof Set) {
|
|
89
|
+
result = new Set();
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
result = {};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Helper to get entries for different types
|
|
96
|
+
* @param {Record<any, any>|Map<any, any>|Set<any>} obj
|
|
97
|
+
*/
|
|
98
|
+
const getEntries = (obj) => {
|
|
99
|
+
if (obj instanceof Map)
|
|
100
|
+
return Array.from(obj.entries());
|
|
101
|
+
if (obj instanceof Set)
|
|
102
|
+
return Array.from(obj.values()).map((v) => [undefined, v]);
|
|
103
|
+
return Object.entries(obj);
|
|
104
|
+
};
|
|
105
|
+
const entries = getEntries(value);
|
|
106
|
+
/**
|
|
107
|
+
* Helper function to recursively reconstruct and filter arrays
|
|
108
|
+
* @param {any[]} arr
|
|
109
|
+
* @param {any} key
|
|
110
|
+
* @returns {any[]}
|
|
111
|
+
*/
|
|
112
|
+
const processArray = (arr, key) => {
|
|
113
|
+
const newArr = [];
|
|
114
|
+
for (let i = 0; i < arr.length; i++) {
|
|
115
|
+
const arrValue = arr[i];
|
|
116
|
+
// Case 1: Value is an Array
|
|
117
|
+
if (Array.isArray(arrValue)) {
|
|
118
|
+
newArr.push(processArray(arrValue, key));
|
|
119
|
+
}
|
|
120
|
+
// Case 2: Value is an Object, Map, or Set
|
|
121
|
+
else if (isValidObj(arrValue)) {
|
|
122
|
+
const d = jsonFilterRecursive(arrValue, filter);
|
|
123
|
+
if (typeof filter.obj !== 'undefined' ? filter.obj(d, i, arr) : true) {
|
|
124
|
+
newArr.push(d);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Case 3: Value is a primitive/other
|
|
128
|
+
else {
|
|
129
|
+
if (typeof filter.value !== 'undefined' ? filter.value([key, arrValue], i, arr) : true) {
|
|
130
|
+
newArr.push(arrValue);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return newArr;
|
|
135
|
+
};
|
|
136
|
+
// Main loop to build the new structure
|
|
137
|
+
for (let index = 0; index < entries.length; index++) {
|
|
138
|
+
const [key, val] = entries[index];
|
|
139
|
+
// Case 1: Value is an Array
|
|
140
|
+
if (Array.isArray(val)) {
|
|
141
|
+
const newArr = processArray(val, key);
|
|
142
|
+
const shouldKeep = typeof filter.array !== 'undefined' ? filter.array([key, newArr], index, entries) : true;
|
|
143
|
+
if (shouldKeep) {
|
|
144
|
+
if (result instanceof Map || result instanceof Set) {
|
|
145
|
+
// This part handles if the root itself was a Map/Set
|
|
146
|
+
if (result instanceof Map)
|
|
147
|
+
result.set(key, newArr);
|
|
148
|
+
else
|
|
149
|
+
result.add(newArr);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
result[key] = newArr;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Case 2: Value is an Object, Map, or Set
|
|
158
|
+
else if (isValidObj(val)) {
|
|
159
|
+
const d = jsonFilterRecursive(val, filter);
|
|
160
|
+
const shouldKeep = typeof filter.obj !== 'undefined' ? filter.obj(d, index, entries) : true;
|
|
161
|
+
if (shouldKeep) {
|
|
162
|
+
if (result instanceof Map) {
|
|
163
|
+
result.set(key, d);
|
|
164
|
+
}
|
|
165
|
+
else if (result instanceof Set) {
|
|
166
|
+
result.add(d);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
result[key] = d;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Case 3: Value is a primitive/other
|
|
175
|
+
else {
|
|
176
|
+
const shouldKeep = typeof filter.value !== 'undefined' ? filter.value([key, val], index, entries) : true;
|
|
177
|
+
if (shouldKeep) {
|
|
178
|
+
if (result instanceof Map) {
|
|
179
|
+
result.set(key, val);
|
|
180
|
+
}
|
|
181
|
+
else if (result instanceof Set) {
|
|
182
|
+
result.add(val);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// @ts-ignore
|
|
186
|
+
result[key] = val;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// We use a type cast here because TypeScript infers `result` as `any` initially.
|
|
192
|
+
return /** @type {Partial<T>} */ (result);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* A predicate function used to validate whether a given value satisfies a specific condition or type requirement.
|
|
196
|
+
* @typedef {(value: any) => boolean} ValueTypeValidator
|
|
197
|
+
*/
|
|
198
|
+
/**
|
|
199
|
+
* @template {Record<any, any>} T
|
|
200
|
+
* @param {T} item - The source object to be filtered.
|
|
201
|
+
* @param {(RecordKey|[any, any|ValueTypeValidator])[]} keys - An array of keys or [key, value/validator] tuples to keep.
|
|
202
|
+
* @param {(any|ValueTypeValidator)[]} [values] - An array of values or validators to validate against when using simple keys.
|
|
203
|
+
* @returns {Partial<T>} - A new object containing only the specified keys.
|
|
204
|
+
* @throws {TypeError} If the item is not a non-null object, keys is not an array, or values is not an array.
|
|
205
|
+
*/
|
|
206
|
+
export function jsonFilterByKeys(item, keys, values) {
|
|
207
|
+
if (!Array.isArray(keys)) {
|
|
208
|
+
throw new TypeError('The second argument must be an array.');
|
|
209
|
+
}
|
|
210
|
+
if (typeof values !== 'undefined' && !Array.isArray(values)) {
|
|
211
|
+
throw new TypeError('The third argument must be an array.');
|
|
212
|
+
}
|
|
213
|
+
return jsonFilter(item,
|
|
214
|
+
// @ts-ignore
|
|
215
|
+
([key, value]) => {
|
|
216
|
+
if (keys.length > 0)
|
|
217
|
+
return keys.some((k) => {
|
|
218
|
+
// Case 1: The element in 'keys' is a tuple [targetKey, targetValueOrValidator]
|
|
219
|
+
if (Array.isArray(k)) {
|
|
220
|
+
const [targetKey, targetValue] = k;
|
|
221
|
+
const keyMatches = key === targetKey;
|
|
222
|
+
const valueMatches = typeof targetValue === 'function' ? targetValue(value) : value === targetValue;
|
|
223
|
+
return keyMatches && valueMatches;
|
|
224
|
+
}
|
|
225
|
+
// Case 2: The element in 'keys' is a simple key
|
|
226
|
+
const keyMatches = key === k;
|
|
227
|
+
// Universal validation: check if value is in 'values' OR matches a validator in 'values'
|
|
228
|
+
const valueMatches = typeof values === 'undefined' ||
|
|
229
|
+
values.some((v) => (typeof v === 'function' ? v(value) : v === value));
|
|
230
|
+
return keyMatches && valueMatches;
|
|
231
|
+
});
|
|
232
|
+
// Universal validation: check if value is in 'values' OR matches a validator in 'values'
|
|
233
|
+
if (typeof values !== 'undefined')
|
|
234
|
+
return values.some((v) => (typeof v === 'function' ? v(value) : v === value));
|
|
235
|
+
return false;
|
|
236
|
+
});
|
|
237
|
+
}
|