tiny-essentials 1.28.18 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/changelog/1/28/19.md +24 -0
- package/changelog/1/29/0.md +58 -0
- package/dist/v1/ColorSafeStringify.min.js +1 -1
- 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/TinyArrayComparator.min.js +1 -1
- package/dist/v1/TinyArrayPaginator.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyBrowserMonitor.min.js +1 -0
- package/dist/v1/TinyClassManager.min.js +1 -1
- package/dist/v1/TinyClipboard.min.js +1 -1
- package/dist/v1/TinyCloner.min.js +1 -0
- package/dist/v1/TinyColorConverter.min.js +1 -1
- package/dist/v1/TinyColorValidator.min.js +1 -1
- package/dist/v1/TinyCookieConsent.min.js +1 -1
- package/dist/v1/TinyDayNightCycle.min.js +1 -1
- package/dist/v1/TinyDebugger.min.js +1 -1
- package/dist/v1/TinyDomReadyManager.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/TinyHtmlTagRegexBuilder.min.js +1 -0
- package/dist/v1/TinyHttpResponseRegistry.min.js +1 -0
- package/dist/v1/TinyI18.min.js +1 -1
- package/dist/v1/TinyIframeEvents.min.js +1 -1
- package/dist/v1/TinyInventory.min.js +1 -1
- package/dist/v1/TinyInventoryTrader.min.js +1 -1
- package/dist/v1/TinyLevelUp.min.js +1 -1
- package/dist/v1/TinyLoadingScreen.min.js +1 -1
- package/dist/v1/TinyLocalStorage.min.js +1 -1
- package/dist/v1/TinyMaInSys.min.js +1 -1
- package/dist/v1/TinyMapCache.min.js +1 -0
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyNeedBar.min.js +1 -1
- package/dist/v1/TinyNewWinEvents.min.js +1 -1
- package/dist/v1/TinyNotificationAdapter.min.js +1 -0
- package/dist/v1/TinyNotifications.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyOPFSFileSystem.min.js +1 -0
- package/dist/v1/TinyPasswordValidator.min.js +1 -0
- package/dist/v1/TinyPluginPackage.min.js +1 -0
- package/dist/v1/TinyPromiseQueue.min.js +1 -1
- package/dist/v1/TinyPushManager.min.js +1 -0
- package/dist/v1/TinyPushPayload.min.js +1 -0
- package/dist/v1/TinyPushRouter.min.js +1 -0
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinyRegexEs.min.js +1 -0
- package/dist/v1/TinyRouter.min.js +1 -0
- package/dist/v1/TinyServiceWorker.min.js +1 -0
- package/dist/v1/TinyServiceWorkerEngine.min.js +1 -0
- package/dist/v1/TinySetMapPackage.min.js +1 -0
- package/dist/v1/TinySimpleDice.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyStorageBucketFileSystem.min.js +1 -0
- package/dist/v1/TinyTextDiffer.min.js +1 -1
- package/dist/v1/TinyTextRangeEditor.min.js +1 -1
- package/dist/v1/TinyTextarea.min.js +1 -1
- package/dist/v1/TinyThrottledApi.min.js +1 -0
- 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/TinyUriParser.min.js +1 -0
- package/dist/v1/TinyVersion.min.js +1 -0
- package/dist/v1/TinyWebWorker.min.js +1 -0
- package/dist/v1/TinyWebWorkerEngine.min.js +1 -0
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/array.cjs +2 -2
- package/dist/v1/basics/array.d.mts +2 -0
- package/dist/v1/basics/array.d.mts.map +1 -1
- package/dist/v1/basics/array.mjs +2 -1
- package/dist/v1/basics/browserDetector.cjs +37 -12
- package/dist/v1/basics/browserDetector.d.mts +8 -0
- package/dist/v1/basics/browserDetector.d.mts.map +1 -1
- package/dist/v1/basics/browserDetector.mjs +32 -13
- package/dist/v1/basics/crypto.cjs +23 -0
- package/dist/v1/basics/crypto.d.mts +10 -0
- package/dist/v1/basics/crypto.d.mts.map +1 -0
- package/dist/v1/basics/crypto.mjs +18 -0
- package/dist/v1/basics/html.cjs +0 -3
- package/dist/v1/basics/html.d.mts.map +1 -1
- package/dist/v1/basics/html.mjs +0 -2
- package/dist/v1/basics/index.cjs +8 -1
- package/dist/v1/basics/index.d.mts +6 -5
- package/dist/v1/basics/index.d.mts.map +1 -1
- package/dist/v1/basics/index.mjs +6 -5
- package/dist/v1/basics/objChecker.cjs +88 -0
- package/dist/v1/basics/objChecker.d.mts +26 -0
- package/dist/v1/basics/objChecker.d.mts.map +1 -1
- package/dist/v1/basics/objChecker.mjs +74 -0
- package/dist/v1/basics/objFilter.cjs +234 -93
- package/dist/v1/basics/objFilter.d.mts +96 -22
- package/dist/v1/basics/objFilter.d.mts.map +1 -1
- package/dist/v1/basics/objFilter.mjs +216 -92
- package/dist/v1/basics/promiseUtils.cjs +48 -12
- package/dist/v1/basics/promiseUtils.d.mts +45 -12
- package/dist/v1/basics/promiseUtils.d.mts.map +1 -1
- package/dist/v1/basics/promiseUtils.mjs +47 -12
- package/dist/v1/basics/text.cjs +0 -12
- package/dist/v1/basics/text.d.mts +0 -10
- package/dist/v1/basics/text.d.mts.map +1 -1
- package/dist/v1/basics/text.mjs +0 -10
- package/dist/v1/css/TinyCookieConsent.min.css +1 -0
- package/dist/v1/css/TinyCookieConsent.min.css.map +1 -0
- package/dist/v1/css/TinyDraggerExample.min.css +1 -0
- package/dist/v1/css/TinyDraggerExample.min.css.map +1 -0
- package/dist/v1/css/TinyLoadingScreen.min.css +1 -0
- package/dist/v1/css/TinyLoadingScreen.min.css.map +1 -0
- package/dist/v1/css/TinyNotify.min.css +1 -0
- package/dist/v1/css/TinyNotify.min.css.map +1 -0
- package/dist/v1/css/aiMarker.min.css +1 -0
- package/dist/v1/css/aiMarker.min.css.map +1 -0
- package/dist/v1/index.cjs +88 -3
- package/dist/v1/index.d.mts +31 -6
- package/dist/v1/index.d.mts.map +1 -1
- package/dist/v1/index.mjs +32 -7
- package/dist/v1/jsdoc/EventEmitter.cjs +4 -0
- package/dist/v1/jsdoc/EventEmitter.d.mts +33 -0
- package/dist/v1/jsdoc/EventEmitter.d.mts.map +1 -0
- package/dist/v1/jsdoc/EventEmitter.mjs +18 -0
- package/dist/v1/libs/array/TinyArrayComparator.cjs +240 -25
- package/dist/v1/libs/array/TinyArrayComparator.d.mts +130 -22
- package/dist/v1/libs/array/TinyArrayComparator.d.mts.map +1 -1
- package/dist/v1/libs/array/TinyArrayComparator.mjs +210 -24
- package/dist/v1/libs/fs/constants.cjs +74 -0
- package/dist/v1/libs/fs/constants.d.mts +22 -0
- package/dist/v1/libs/fs/constants.d.mts.map +1 -0
- package/dist/v1/libs/fs/constants.mjs +53 -0
- package/dist/v1/libs/fs/encoding.cjs +118 -0
- package/dist/v1/libs/fs/encoding.d.mts +50 -0
- package/dist/v1/libs/fs/encoding.d.mts.map +1 -0
- package/dist/v1/libs/fs/encoding.mjs +102 -0
- package/dist/v1/libs/fs/error.cjs +188 -0
- package/dist/v1/libs/fs/error.d.mts +105 -0
- package/dist/v1/libs/fs/error.d.mts.map +1 -0
- package/dist/v1/libs/fs/error.mjs +158 -0
- package/dist/v1/libs/fs/handle.cjs +121 -0
- package/dist/v1/libs/fs/handle.d.mts +56 -0
- package/dist/v1/libs/fs/handle.d.mts.map +1 -0
- package/dist/v1/libs/fs/handle.mjs +100 -0
- package/dist/v1/libs/fs/index.cjs +700 -0
- package/dist/v1/libs/fs/index.d.mts +377 -0
- package/dist/v1/libs/fs/index.d.mts.map +1 -0
- package/dist/v1/libs/fs/index.mjs +630 -0
- package/dist/v1/libs/fs/path.cjs +234 -0
- package/dist/v1/libs/fs/path.d.mts +176 -0
- package/dist/v1/libs/fs/path.d.mts.map +1 -0
- package/dist/v1/libs/fs/path.mjs +197 -0
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.cjs +202 -0
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts +121 -0
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts.map +1 -0
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.mjs +172 -0
- package/dist/v1/libs/fs/plugins/OPFS/index.cjs +334 -0
- package/dist/v1/libs/fs/plugins/OPFS/index.d.mts +98 -0
- package/dist/v1/libs/fs/plugins/OPFS/index.d.mts.map +1 -0
- package/dist/v1/libs/fs/plugins/OPFS/index.mjs +300 -0
- package/dist/v1/libs/fs/stats.cjs +245 -0
- package/dist/v1/libs/fs/stats.d.mts +226 -0
- package/dist/v1/libs/fs/stats.d.mts.map +1 -0
- package/dist/v1/libs/fs/stats.mjs +197 -0
- package/dist/v1/libs/html/events/TinyIframeEvents.cjs +10 -1
- package/dist/v1/libs/html/events/TinyIframeEvents.d.mts +9 -2
- package/dist/v1/libs/html/events/TinyIframeEvents.d.mts.map +1 -1
- package/dist/v1/libs/html/events/TinyIframeEvents.mjs +8 -1
- package/dist/v1/libs/html/events/TinyNewWinEvents.cjs +14 -3
- package/dist/v1/libs/html/events/TinyNewWinEvents.d.mts +21 -5
- package/dist/v1/libs/html/events/TinyNewWinEvents.d.mts.map +1 -1
- package/dist/v1/libs/html/events/TinyNewWinEvents.mjs +12 -3
- package/dist/v1/libs/html/scroll/TinySmartScroller.cjs +13 -1
- package/dist/v1/libs/html/scroll/TinySmartScroller.d.mts +29 -2
- package/dist/v1/libs/html/scroll/TinySmartScroller.d.mts.map +1 -1
- package/dist/v1/libs/html/scroll/TinySmartScroller.mjs +11 -1
- package/dist/v1/libs/math/TinyAdvancedRaffle.cjs +13 -1
- package/dist/v1/libs/math/TinyAdvancedRaffle.d.mts +32 -2
- package/dist/v1/libs/math/TinyAdvancedRaffle.d.mts.map +1 -1
- package/dist/v1/libs/math/TinyAdvancedRaffle.mjs +11 -1
- package/dist/v1/libs/math/TinyTimeout.cjs +0 -14
- package/dist/v1/libs/math/TinyTimeout.d.mts +0 -11
- package/dist/v1/libs/math/TinyTimeout.d.mts.map +1 -1
- package/dist/v1/libs/math/TinyTimeout.mjs +0 -13
- package/dist/v1/libs/media/TinyMediaPlayer/index.cjs +25 -1
- package/dist/v1/libs/media/TinyMediaPlayer/index.d.mts +35 -2
- package/dist/v1/libs/media/TinyMediaPlayer/index.d.mts.map +1 -1
- package/dist/v1/libs/media/TinyMediaPlayer/index.mjs +23 -1
- package/dist/v1/libs/media/TinyMediaPlayer.cjs +2 -2
- package/dist/v1/libs/media/TinyMediaPlayer.d.mts +2 -2
- package/dist/v1/libs/media/TinyMediaPlayer.d.mts.map +1 -1
- package/dist/v1/libs/media/TinyMediaPlayer.mjs +2 -2
- package/dist/v1/libs/media/TinyRadioFm.cjs +19 -1
- package/dist/v1/libs/media/TinyRadioFm.d.mts +78 -2
- package/dist/v1/libs/media/TinyRadioFm.d.mts.map +1 -1
- package/dist/v1/libs/media/TinyRadioFm.mjs +17 -1
- package/dist/v1/libs/plugin/TinyPlugin.cjs +1630 -0
- package/dist/v1/libs/plugin/TinyPlugin.d.mts +753 -0
- package/dist/v1/libs/plugin/TinyPlugin.d.mts.map +1 -0
- package/dist/v1/libs/plugin/TinyPlugin.mjs +1376 -0
- package/dist/v1/libs/plugin/TinyVersion.cjs +204 -0
- package/dist/v1/libs/plugin/TinyVersion.d.mts +70 -0
- package/dist/v1/libs/plugin/TinyVersion.d.mts.map +1 -0
- package/dist/v1/libs/plugin/TinyVersion.mjs +179 -0
- package/dist/v1/libs/router/TinyRouter.cjs +661 -0
- package/dist/v1/libs/router/TinyRouter.d.mts +320 -0
- package/dist/v1/libs/router/TinyRouter.d.mts.map +1 -0
- package/dist/v1/libs/router/TinyRouter.mjs +572 -0
- package/dist/v1/libs/storage/TinyLocalStorage.cjs +20 -1
- package/dist/v1/libs/storage/TinyLocalStorage.d.mts +64 -2
- package/dist/v1/libs/storage/TinyLocalStorage.d.mts.map +1 -1
- package/dist/v1/libs/storage/TinyLocalStorage.mjs +18 -1
- package/dist/v1/libs/storage/TinyMapCache.cjs +373 -0
- package/dist/v1/libs/storage/TinyMapCache.d.mts +274 -0
- package/dist/v1/libs/storage/TinyMapCache.d.mts.map +1 -0
- package/dist/v1/libs/storage/TinyMapCache.mjs +333 -0
- package/dist/v1/libs/storage/TinySetMapDatabase.cjs +1167 -0
- package/dist/v1/libs/storage/TinySetMapDatabase.d.mts +603 -0
- package/dist/v1/libs/storage/TinySetMapDatabase.d.mts.map +1 -0
- package/dist/v1/libs/storage/TinySetMapDatabase.mjs +1059 -0
- package/dist/v1/libs/sw/browser/TinyNotificationAdapter.cjs +126 -0
- package/dist/v1/libs/sw/browser/TinyNotificationAdapter.d.mts +132 -0
- package/dist/v1/libs/sw/browser/TinyNotificationAdapter.d.mts.map +1 -0
- package/dist/v1/libs/sw/browser/TinyNotificationAdapter.mjs +109 -0
- package/dist/v1/libs/sw/browser/TinyPushManager.cjs +310 -0
- package/dist/v1/libs/sw/browser/TinyPushManager.d.mts +168 -0
- package/dist/v1/libs/sw/browser/TinyPushManager.d.mts.map +1 -0
- package/dist/v1/libs/sw/browser/TinyPushManager.mjs +264 -0
- package/dist/v1/libs/sw/browser/TinyServiceWorker.cjs +1060 -0
- package/dist/v1/libs/sw/browser/TinyServiceWorker.d.mts +348 -0
- package/dist/v1/libs/sw/browser/TinyServiceWorker.d.mts.map +1 -0
- package/dist/v1/libs/sw/browser/TinyServiceWorker.mjs +933 -0
- package/dist/v1/libs/sw/browser/plugins/TabManager.cjs +315 -0
- package/dist/v1/libs/sw/browser/plugins/TabManager.d.mts +178 -0
- package/dist/v1/libs/sw/browser/plugins/TabManager.d.mts.map +1 -0
- package/dist/v1/libs/sw/browser/plugins/TabManager.mjs +274 -0
- package/dist/v1/libs/sw/browser/utils.cjs +28 -0
- package/dist/v1/libs/sw/browser/utils.d.mts +8 -0
- package/dist/v1/libs/sw/browser/utils.d.mts.map +1 -0
- package/dist/v1/libs/sw/browser/utils.mjs +21 -0
- package/dist/v1/libs/sw/service/TinyPushRouter.cjs +222 -0
- package/dist/v1/libs/sw/service/TinyPushRouter.d.mts +138 -0
- package/dist/v1/libs/sw/service/TinyPushRouter.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/TinyPushRouter.mjs +201 -0
- package/dist/v1/libs/sw/service/TinyServiceWorkerEngine.cjs +3016 -0
- package/dist/v1/libs/sw/service/TinyServiceWorkerEngine.d.mts +993 -0
- package/dist/v1/libs/sw/service/TinyServiceWorkerEngine.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/TinyServiceWorkerEngine.mjs +2558 -0
- package/dist/v1/libs/sw/service/plugins/GlobBypassPlugin.cjs +88 -0
- package/dist/v1/libs/sw/service/plugins/GlobBypassPlugin.d.mts +32 -0
- package/dist/v1/libs/sw/service/plugins/GlobBypassPlugin.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/plugins/GlobBypassPlugin.mjs +69 -0
- package/dist/v1/libs/sw/service/plugins/GlobCachePlugin.cjs +112 -0
- package/dist/v1/libs/sw/service/plugins/GlobCachePlugin.d.mts +31 -0
- package/dist/v1/libs/sw/service/plugins/GlobCachePlugin.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/plugins/GlobCachePlugin.mjs +91 -0
- package/dist/v1/libs/sw/service/plugins/Ping.cjs +32 -0
- package/dist/v1/libs/sw/service/plugins/Ping.d.mts +9 -0
- package/dist/v1/libs/sw/service/plugins/Ping.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/plugins/Ping.mjs +25 -0
- package/dist/v1/libs/sw/service/plugins/TabManager.cjs +457 -0
- package/dist/v1/libs/sw/service/plugins/TabManager.d.mts +91 -0
- package/dist/v1/libs/sw/service/plugins/TabManager.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/plugins/TabManager.mjs +372 -0
- package/dist/v1/libs/sw/service/plugins/ViteFileDetector.cjs +180 -0
- package/dist/v1/libs/sw/service/plugins/ViteFileDetector.d.mts +28 -0
- package/dist/v1/libs/sw/service/plugins/ViteFileDetector.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/plugins/ViteFileDetector.mjs +148 -0
- package/dist/v1/libs/sw/service/shared/TinyPushPayload.cjs +199 -0
- package/dist/v1/libs/sw/service/shared/TinyPushPayload.d.mts +80 -0
- package/dist/v1/libs/sw/service/shared/TinyPushPayload.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/shared/TinyPushPayload.mjs +174 -0
- package/dist/v1/libs/sw/utils.cjs +57 -0
- package/dist/v1/libs/sw/utils.d.mts +173 -0
- package/dist/v1/libs/sw/utils.d.mts.map +1 -0
- package/dist/v1/libs/sw/utils.mjs +50 -0
- package/dist/v1/libs/text/TinyI18/Browser-NON-DOM.cjs +57 -0
- package/dist/v1/libs/text/TinyI18/Browser-NON-DOM.d.mts +39 -0
- package/dist/v1/libs/text/TinyI18/Browser-NON-DOM.d.mts.map +1 -0
- package/dist/v1/libs/text/TinyI18/Browser-NON-DOM.mjs +48 -0
- package/dist/v1/libs/text/TinyI18/Browser.cjs +64 -0
- package/dist/v1/libs/text/TinyI18/Browser.d.mts +47 -0
- package/dist/v1/libs/text/TinyI18/Browser.d.mts.map +1 -0
- package/dist/v1/libs/text/TinyI18/Browser.mjs +57 -0
- package/dist/v1/libs/text/TinyI18/Node.cjs +49 -0
- package/dist/v1/libs/text/TinyI18/Node.d.mts +38 -0
- package/dist/v1/libs/text/TinyI18/Node.d.mts.map +1 -0
- package/dist/v1/libs/text/TinyI18/Node.mjs +43 -0
- package/dist/v1/libs/text/TinyI18/browser-utils.cjs +17 -0
- package/dist/v1/libs/text/TinyI18/browser-utils.d.mts +8 -0
- package/dist/v1/libs/text/TinyI18/browser-utils.d.mts.map +1 -0
- package/dist/v1/libs/text/TinyI18/browser-utils.mjs +13 -0
- package/dist/v1/libs/text/{TinyI18.cjs → TinyI18/index.cjs} +205 -104
- package/dist/v1/libs/text/{TinyI18.d.mts → TinyI18/index.d.mts} +141 -92
- package/dist/v1/libs/text/TinyI18/index.d.mts.map +1 -0
- package/dist/v1/libs/text/{TinyI18.mjs → TinyI18/index.mjs} +195 -101
- package/dist/v1/libs/tools/TinyBrowserMonitor.cjs +1088 -0
- package/dist/v1/libs/tools/TinyBrowserMonitor.d.mts +621 -0
- package/dist/v1/libs/tools/TinyBrowserMonitor.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyBrowserMonitor.mjs +940 -0
- package/dist/v1/libs/tools/TinyDebugger.cjs +180 -19
- package/dist/v1/libs/tools/TinyDebugger.d.mts +220 -24
- package/dist/v1/libs/tools/TinyDebugger.d.mts.map +1 -1
- package/dist/v1/libs/tools/TinyDebugger.mjs +161 -19
- package/dist/v1/libs/tools/TinyHtmlTagRegexBuilder.cjs +256 -0
- package/dist/v1/libs/tools/TinyHtmlTagRegexBuilder.d.mts +125 -0
- package/dist/v1/libs/tools/TinyHtmlTagRegexBuilder.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHtmlTagRegexBuilder.mjs +223 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser-NON-DOM.cjs +23 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser-NON-DOM.d.mts +17 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser-NON-DOM.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser-NON-DOM.mjs +19 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser.cjs +23 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser.d.mts +17 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser.mjs +19 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/EmptyRequestCodes.cjs +390 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/EmptyRequestCodes.d.mts +9 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/EmptyRequestCodes.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/EmptyRequestCodes.mjs +387 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/JsDoc.cjs +2 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/JsDoc.d.mts +27 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/JsDoc.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/JsDoc.mjs +12 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/MozillaRequestCodes/LICENSE +53 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/MozillaRequestCodes/index.cjs +405 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/MozillaRequestCodes/index.d.mts +34 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/MozillaRequestCodes/index.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/MozillaRequestCodes/index.mjs +342 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Node.cjs +23 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Node.d.mts +17 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Node.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Node.mjs +19 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/RequestCodes.cjs +327 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/RequestCodes.d.mts +9 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/RequestCodes.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/RequestCodes.mjs +324 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/index.cjs +268 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/index.d.mts +107 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/index.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/index.mjs +238 -0
- package/dist/v1/libs/tools/TinyPasswordValidator.cjs +491 -0
- package/dist/v1/libs/tools/TinyPasswordValidator.d.mts +246 -0
- package/dist/v1/libs/tools/TinyPasswordValidator.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyPasswordValidator.mjs +434 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.cjs +48 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts +14 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts.map +1 -1
- package/dist/v1/libs/tools/TinyPkgExportValidator.mjs +44 -0
- package/dist/v1/libs/tools/TinySiteMap.cjs +1029 -0
- package/dist/v1/libs/tools/TinySiteMap.d.mts +429 -0
- package/dist/v1/libs/tools/TinySiteMap.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinySiteMap.mjs +910 -0
- package/dist/v1/libs/tools/TinySiteMapStream.cjs +121 -0
- package/dist/v1/libs/tools/TinySiteMapStream.d.mts +51 -0
- package/dist/v1/libs/tools/TinySiteMapStream.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinySiteMapStream.mjs +85 -0
- package/dist/v1/libs/tools/TinyURLSecurityVerifier.cjs +444 -0
- package/dist/v1/libs/tools/TinyURLSecurityVerifier.d.mts +217 -0
- package/dist/v1/libs/tools/TinyURLSecurityVerifier.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyURLSecurityVerifier.mjs +394 -0
- package/dist/v1/libs/tools/TinyUriParser/BlueSky.cjs +613 -0
- package/dist/v1/libs/tools/TinyUriParser/BlueSky.d.mts +152 -0
- package/dist/v1/libs/tools/TinyUriParser/BlueSky.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyUriParser/BlueSky.mjs +527 -0
- package/dist/v1/libs/tools/TinyUriParser/Discord.cjs +1119 -0
- package/dist/v1/libs/tools/TinyUriParser/Discord.d.mts +306 -0
- package/dist/v1/libs/tools/TinyUriParser/Discord.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyUriParser/Discord.mjs +968 -0
- package/dist/v1/libs/tools/TinyUriParser/MatrixProtocol.cjs +469 -0
- package/dist/v1/libs/tools/TinyUriParser/MatrixProtocol.d.mts +80 -0
- package/dist/v1/libs/tools/TinyUriParser/MatrixProtocol.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyUriParser/MatrixProtocol.mjs +379 -0
- package/dist/v1/libs/tools/TinyUriParser.cjs +217 -0
- package/dist/v1/libs/tools/TinyUriParser.d.mts +109 -0
- package/dist/v1/libs/tools/TinyUriParser.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyUriParser.mjs +183 -0
- package/dist/v1/libs/utils/TinyCloner.cjs +466 -0
- package/dist/v1/libs/utils/TinyCloner.d.mts +221 -0
- package/dist/v1/libs/utils/TinyCloner.d.mts.map +1 -0
- package/dist/v1/libs/utils/TinyCloner.mjs +416 -0
- package/dist/v1/libs/utils/TinyPromiseQueue.cjs +1 -1
- package/dist/v1/libs/utils/TinyPromiseQueue.d.mts +2 -2
- package/dist/v1/libs/utils/TinyPromiseQueue.d.mts.map +1 -1
- package/dist/v1/libs/utils/TinyPromiseQueue.mjs +1 -1
- package/dist/v1/libs/utils/TinyThrottledApi.cjs +333 -0
- package/dist/v1/libs/utils/TinyThrottledApi.d.mts +163 -0
- package/dist/v1/libs/utils/TinyThrottledApi.d.mts.map +1 -0
- package/dist/v1/libs/utils/TinyThrottledApi.mjs +294 -0
- package/dist/v1/libs/worker/browser/TinyWebWorker.cjs +342 -0
- package/dist/v1/libs/worker/browser/TinyWebWorker.d.mts +97 -0
- package/dist/v1/libs/worker/browser/TinyWebWorker.d.mts.map +1 -0
- package/dist/v1/libs/worker/browser/TinyWebWorker.mjs +305 -0
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.cjs +346 -0
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts +127 -0
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts.map +1 -0
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.mjs +304 -0
- package/dist/v1/regexp/Email.cjs +185 -0
- package/dist/v1/regexp/Email.d.mts +73 -0
- package/dist/v1/regexp/Email.d.mts.map +1 -0
- package/dist/v1/regexp/Email.mjs +153 -0
- package/dist/v1/regexp/Glob.cjs +293 -0
- package/dist/v1/regexp/Glob.d.mts +45 -0
- package/dist/v1/regexp/Glob.d.mts.map +1 -0
- package/dist/v1/regexp/Glob.mjs +260 -0
- package/dist/v1/regexp/Ipv4.cjs +57 -0
- package/dist/v1/regexp/Ipv4.d.mts +29 -0
- package/dist/v1/regexp/Ipv4.d.mts.map +1 -0
- package/dist/v1/regexp/Ipv4.mjs +45 -0
- package/dist/v1/regexp/Ipv6.cjs +67 -0
- package/dist/v1/regexp/Ipv6.d.mts +29 -0
- package/dist/v1/regexp/Ipv6.d.mts.map +1 -0
- package/dist/v1/regexp/Ipv6.mjs +54 -0
- package/dist/v1/regexp/SegmentExtractor.cjs +145 -0
- package/dist/v1/regexp/SegmentExtractor.d.mts +91 -0
- package/dist/v1/regexp/SegmentExtractor.d.mts.map +1 -0
- package/dist/v1/regexp/SegmentExtractor.mjs +116 -0
- package/dist/v1/regexp/UrlDetector.cjs +125 -0
- package/dist/v1/regexp/UrlDetector.d.mts +67 -0
- package/dist/v1/regexp/UrlDetector.d.mts.map +1 -0
- package/dist/v1/regexp/UrlDetector.mjs +102 -0
- package/dist/v1/regexp/Username/index.cjs +233 -0
- package/dist/v1/regexp/Username/index.d.mts +77 -0
- package/dist/v1/regexp/Username/index.d.mts.map +1 -0
- package/dist/v1/regexp/Username/index.mjs +199 -0
- package/dist/v1/regexp/Username/jsDoc.cjs +2 -0
- package/dist/v1/regexp/Username/jsDoc.d.mts +57 -0
- package/dist/v1/regexp/Username/jsDoc.d.mts.map +1 -0
- package/dist/v1/regexp/Username/jsDoc.mjs +18 -0
- package/dist/v1/regexp/Username/templates/BlueSky.cjs +56 -0
- package/dist/v1/regexp/Username/templates/BlueSky.d.mts +35 -0
- package/dist/v1/regexp/Username/templates/BlueSky.d.mts.map +1 -0
- package/dist/v1/regexp/Username/templates/BlueSky.mjs +52 -0
- package/dist/v1/regexp/Username/templates/Discord.cjs +505 -0
- package/dist/v1/regexp/Username/templates/Discord.d.mts +209 -0
- package/dist/v1/regexp/Username/templates/Discord.d.mts.map +1 -0
- package/dist/v1/regexp/Username/templates/Discord.mjs +458 -0
- package/dist/v1/regexp/Username/templates/MatrixProtocol.cjs +143 -0
- package/dist/v1/regexp/Username/templates/MatrixProtocol.d.mts +70 -0
- package/dist/v1/regexp/Username/templates/MatrixProtocol.d.mts.map +1 -0
- package/dist/v1/regexp/Username/templates/MatrixProtocol.mjs +128 -0
- package/dist/v1/regexp/Username/templates/deprecated/Discord.cjs +24 -0
- package/dist/v1/regexp/Username/templates/deprecated/Discord.d.mts +17 -0
- package/dist/v1/regexp/Username/templates/deprecated/Discord.d.mts.map +1 -0
- package/dist/v1/regexp/Username/templates/deprecated/Discord.mjs +20 -0
- package/dist/v1/regexp/Username/templates/index.cjs +11 -0
- package/dist/v1/regexp/Username/templates/index.d.mts +5 -0
- package/dist/v1/regexp/Username/templates/index.d.mts.map +1 -0
- package/dist/v1/regexp/Username/templates/index.mjs +4 -0
- package/dist/v1/regexp/index.cjs +41 -0
- package/dist/v1/regexp/index.d.mts +9 -0
- package/dist/v1/regexp/index.d.mts.map +1 -0
- package/dist/v1/regexp/index.mjs +8 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Browser.cjs +64 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Browser.d.mts +11 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Browser.d.mts.map +1 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Browser.mjs +51 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/FileInput.cjs +66 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/FileInput.d.mts +11 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/FileInput.d.mts.map +1 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/FileInput.mjs +51 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Node.cjs +39 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Node.d.mts +11 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Node.d.mts.map +1 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Node.mjs +28 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Template.cjs +494 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Template.d.mts +142 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Template.d.mts.map +1 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Template.mjs +445 -0
- package/dist/v1/webTemplates/bootstrap/5.3/html/BootstrapDialogs.cjs +725 -0
- package/dist/v1/webTemplates/bootstrap/5.3/html/BootstrapDialogs.d.mts +293 -0
- package/dist/v1/webTemplates/bootstrap/5.3/html/BootstrapDialogs.d.mts.map +1 -0
- package/dist/v1/webTemplates/bootstrap/5.3/html/BootstrapDialogs.mjs +614 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/input/Placeholder-Colors-Fix.scss +64 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/spacing/Spacing-Plus.scss +31 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Browser/index.cjs +135 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Browser/index.d.mts +83 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Browser/index.d.mts.map +1 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Browser/index.mjs +120 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Node/index.cjs +127 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Node/index.d.mts +95 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Node/index.d.mts.map +1 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Node/index.mjs +109 -0
- package/dist/v1/webTemplates/multiformats/14.0/IPFSHasher/index.cjs +83 -0
- package/dist/v1/webTemplates/multiformats/14.0/IPFSHasher/index.d.mts +46 -0
- package/dist/v1/webTemplates/multiformats/14.0/IPFSHasher/index.d.mts.map +1 -0
- package/dist/v1/webTemplates/multiformats/14.0/IPFSHasher/index.mjs +71 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/TinyVitePwaPlugin.cjs +493 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/TinyVitePwaPlugin.d.mts +67 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/TinyVitePwaPlugin.d.mts.map +1 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/TinyVitePwaPlugin.mjs +399 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/githubUtils.cjs +35 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/githubUtils.d.mts +6 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/githubUtils.d.mts.map +1 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/githubUtils.mjs +29 -0
- package/docs/info/RegExp.md +74 -0
- package/docs/v1/Exports.md +111 -0
- package/docs/v1/README.md +117 -13
- package/docs/v1/basics/asyncReplace.md +2 -0
- package/docs/v1/basics/browserDetector.md +28 -11
- package/docs/v1/basics/crypto.md +85 -0
- package/docs/v1/basics/deprecated/html.md +2 -0
- package/docs/v1/basics/deprecated/objFilter.md +2 -0
- package/docs/v1/basics/html.md +2 -0
- package/docs/v1/basics/objChecker.md +55 -0
- package/docs/v1/basics/objFilter.md +57 -86
- package/docs/v1/basics/promiseUtils.md +12 -3
- package/docs/v1/basics/text.md +0 -1
- package/docs/v1/libs/array/TinyArrayComparator.md +50 -39
- package/docs/v1/libs/fs/TinyFS.md +752 -0
- package/docs/v1/libs/fs/TinyOPFSFileSystem.md +495 -0
- package/docs/v1/libs/fs/TinyStorageBucketFileSystem.md +407 -0
- package/docs/v1/libs/plugin/TinyPlugin.md +441 -0
- package/docs/v1/libs/plugin/TinyVersion.md +145 -0
- package/docs/v1/libs/router/TinyRouter.md +216 -0
- package/docs/v1/libs/storage/TinyMapCache.md +219 -0
- package/docs/v1/libs/storage/TinySetMapDatabase.md +478 -0
- package/docs/v1/libs/sw/browser/TinyNotificationAdapter.md +280 -0
- package/docs/v1/libs/sw/browser/TinyPushManager.md +782 -0
- package/docs/v1/libs/sw/browser/TinyServiceWorker.md +365 -0
- package/docs/v1/libs/sw/browser/plugins/TabManager.md +133 -0
- package/docs/v1/libs/sw/service/TinyPushRouter.md +314 -0
- package/docs/v1/libs/sw/service/TinyServiceWorkerEngine.md +748 -0
- package/docs/v1/libs/sw/service/plugins/GlobBypassPlugin.md +229 -0
- package/docs/v1/libs/sw/service/plugins/GlobCachePlugin.md +91 -0
- package/docs/v1/libs/sw/service/plugins/Ping.md +36 -0
- package/docs/v1/libs/sw/service/plugins/TabManager.md +64 -0
- package/docs/v1/libs/sw/service/plugins/ViteFileDetector.md +92 -0
- package/docs/v1/libs/sw/service/shared/TinyPushPayload.md +316 -0
- package/docs/v1/libs/text/TinyI18.md +80 -56
- package/docs/v1/libs/tools/TinyBrowserMonitor.md +170 -0
- package/docs/v1/libs/tools/TinyDebugger.md +117 -1
- package/docs/v1/libs/tools/TinyHtmlTagRegexBuilder.md +141 -0
- package/docs/v1/libs/tools/TinyHttpResponseRegistry.md +129 -0
- package/docs/v1/libs/tools/TinyPasswordValidator.md +153 -0
- package/docs/v1/libs/tools/TinyPkgExportValidator.md +45 -1
- package/docs/v1/libs/tools/TinySiteMap.md +134 -0
- package/docs/v1/libs/tools/TinySiteMapStream.md +97 -0
- package/docs/v1/libs/tools/TinyURLSecurityVerifier.md +146 -0
- package/docs/v1/libs/tools/TinyUriParser/Discord.md +374 -0
- package/docs/v1/libs/tools/TinyUriParser/MatrixProtocol.md +54 -0
- package/docs/v1/libs/tools/TinyUriParser.md +128 -0
- package/docs/v1/libs/utils/TinyCloner.md +126 -0
- package/docs/v1/libs/utils/TinyPromiseQueue.md +1 -1
- package/docs/v1/libs/utils/TinyThrottledApi.md +219 -0
- package/docs/v1/libs/worker/browser/TinyWebWorker.md +331 -0
- package/docs/v1/libs/worker/engine/TinyWebWorkerEngine.md +137 -0
- package/docs/v1/regexp/Email.md +127 -0
- package/docs/v1/regexp/Glob.md +155 -0
- package/docs/v1/regexp/IPv4.md +103 -0
- package/docs/v1/regexp/IPv6.md +122 -0
- package/docs/v1/regexp/SegmentExtractor.md +120 -0
- package/docs/v1/regexp/UrlDetector.md +117 -0
- package/docs/v1/regexp/Username/Base.md +131 -0
- package/docs/v1/regexp/Username/Discord.md +267 -0
- package/docs/v1/regexp/Username/MatrixProtocol.md +131 -0
- package/docs/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters.md +569 -0
- package/docs/v1/webTemplates/bootstrap/5.3/html/BootstrapDialogs.md +174 -0
- package/docs/v1/webTemplates/media/MediaValidator/v1/Browser.md +123 -0
- package/docs/v1/webTemplates/media/MediaValidator/v1/Node.md +136 -0
- package/docs/v1/webTemplates/multiformats/14.0/IPFSHasher.md +310 -0
- package/docs/v1/webTemplates/vite/7.3/plugins/TinyVitePwaPlugin.md +131 -0
- package/docs/v1/webTemplates/vite/7.3/plugins/githubUtils.md +50 -0
- package/package.json +313 -18
- package/types/EventEmitter.d.ts +48 -0
- package/dist/v1/libs/text/TinyI18.d.mts.map +0 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# 📧 Email Validation Toolkit
|
|
2
|
+
|
|
3
|
+
A robust, highly configurable JavaScript utility for validating email addresses and extracting them from text using customizable Regular Expressions and strict filtering rules.
|
|
4
|
+
|
|
5
|
+
## 🌟 Overview
|
|
6
|
+
|
|
7
|
+
This toolkit is designed for developers who need more than just basic email validation. It allows you to define exactly what a "valid" email looks like for your specific application—whether you want to restrict users to a specific company domain, block certain usernames, or use custom logic.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ⚙️ The Configuration Object (`EmailRegexOptions`)
|
|
12
|
+
|
|
13
|
+
The "brain" of this toolkit is the `options` object. Instead of writing complex Regex every time, you pass this object to the functions to control the behavior.
|
|
14
|
+
|
|
15
|
+
| Property | Type | Description |
|
|
16
|
+
| :--- | :--- | :--- |
|
|
17
|
+
| `validName` | `string` | The regex pattern for the part **before** the `@`. (Default: `[a-zA-Z0-9._%+-]+`) |
|
|
18
|
+
| `validDomain` | `string` | The regex pattern for the part **after** the `@`. (Default: `[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}`) |
|
|
19
|
+
| `blacklistDomains` | `string[]` | List of domains that are **not** allowed (e.g., `['tempmail.com']`). |
|
|
20
|
+
| `whitelistDomains` | `string[]` | List of domains that are the **only** ones allowed. |
|
|
21
|
+
| `blacklistUsernames` | `string[]` | List of usernames that are **not** allowed (e.g., `['admin', 'root']`). |
|
|
22
|
+
| `whitelistUsernames` | `string[]` | List of usernames that are the **only** ones allowed. |
|
|
23
|
+
| `customValidator` | `Function` | A function `(email: string) => boolean` for logic that Regex cannot handle. |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 🛠️ Core Functions
|
|
28
|
+
|
|
29
|
+
### 1. `isValidEmail(s, options)`
|
|
30
|
+
**The most common tool.** Use this to check if a single string is a valid email based on your rules.
|
|
31
|
+
|
|
32
|
+
* **Input:** A `string` and an optional `options` object.
|
|
33
|
+
* **Returns:** `boolean` (`true` if valid, `false` otherwise).
|
|
34
|
+
* **Throws:** `TypeError` if the first argument is not a string.
|
|
35
|
+
|
|
36
|
+
### 2. `extractEmails(text, options)`
|
|
37
|
+
**The "Scraper" tool.** Use this when you have a large block of text (like a comment section or an email body) and you want to find all valid emails within it.
|
|
38
|
+
|
|
39
|
+
* **Input:** A `string` (the text to search) and an optional `options` object.
|
|
40
|
+
* **Returns:** `string[]` (An array of found emails. Returns an empty array `[]` if none are found).
|
|
41
|
+
* **Throws:** `TypeError` if the input text is not a string.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🚀 Practical Daily Scenarios
|
|
46
|
+
|
|
47
|
+
Here is how you would use these tools in different professional programming scenarios.
|
|
48
|
+
|
|
49
|
+
### Scenario A: Simple Validation 🔍
|
|
50
|
+
*Goal: Just check if the email follows standard formatting.*
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
import { isValidEmail } from 'tiny-essentials/regexp/Email';
|
|
54
|
+
|
|
55
|
+
const email = "user@example.com";
|
|
56
|
+
|
|
57
|
+
if (isValidEmail(email)) {
|
|
58
|
+
console.log("✅ This is a valid email format.");
|
|
59
|
+
} else {
|
|
60
|
+
console.log("❌ Invalid email format.");
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Scenario B: Corporate/Internal Restriction 🏢
|
|
65
|
+
*Goal: Only allow users from your company domain (`@company.com`).*
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
import { isValidEmail } from 'tiny-essentials/regexp/Email';
|
|
69
|
+
|
|
70
|
+
const userEmail = "employee@company.com";
|
|
71
|
+
const guestEmail = "stranger@gmail.com";
|
|
72
|
+
|
|
73
|
+
const companyOnlyOptions = {
|
|
74
|
+
whitelistDomains: ['company.com']
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
console.log(isValidEmail(userEmail, companyOnlyOptions)); // true
|
|
78
|
+
console.log(isValidEmail(guestEmail, companyOnlyOptions)); // false
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Scenario C: Preventing "Bad" Usernames & Domains 🛡️
|
|
82
|
+
*Goal: Block specific disposable email providers and restricted usernames.*
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
import { isValidEmail } from 'tiny-essentials/regexp/Email';
|
|
86
|
+
|
|
87
|
+
const securityOptions = {
|
|
88
|
+
blacklistDomains: ['spam.org', 'trashmail.net'],
|
|
89
|
+
blacklistUsernames: ['admin', 'root', 'support']
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
console.log(isValidEmail("admin@example.com", securityOptions)); // false (Username is blacklisted)
|
|
93
|
+
console.log(isValidEmail("user@spam.org", securityOptions)); // false (Domain is blacklisted)
|
|
94
|
+
console.log(isValidEmail("valid.user@example.com", securityOptions)); // true
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Scenario D: Extracting Emails from a Log File 📑
|
|
98
|
+
*Goal: Pull all valid emails from a messy text block.*
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
import { extractEmails } from 'tiny-essentials/regexp/Email';
|
|
102
|
+
|
|
103
|
+
const logData = "Contact us at support@company.com or sales@company.com. Do not use admin@evil.com.";
|
|
104
|
+
|
|
105
|
+
const options = {
|
|
106
|
+
whitelistDomains: ['company.com']
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const validCompanyEmails = extractEmails(logData, options);
|
|
110
|
+
|
|
111
|
+
console.log(validCompanyEmails);
|
|
112
|
+
// Output: ["support@company.com", "sales@company.com"]
|
|
113
|
+
// Note: "admin@evil.com" was ignored because it didn't match the whitelist.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## ⚠️ Error Handling & Safety
|
|
119
|
+
|
|
120
|
+
This module is designed with **Strict Type Safety**. To prevent bugs in large applications, the functions will throw errors if you pass the wrong data types.
|
|
121
|
+
|
|
122
|
+
| Error Type | Cause |
|
|
123
|
+
| :--- | :--- |
|
|
124
|
+
| `TypeError` | You passed a `number` or `null` instead of a `string` to `isValidEmail` or `extractEmails`. |
|
|
125
|
+
| `TypeError` | You passed an invalid object to the `options` parameter (e.g., a `blacklistDomain` that is a string instead of an array). |
|
|
126
|
+
|
|
127
|
+
**Pro-tip:** Always wrap your calls in `try...catch` blocks if you are handling user input that might be unpredictable!
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# 🌟 GlobMaster Utility
|
|
2
|
+
|
|
3
|
+
Welcome to the **GlobMaster** documentation! 🚀 This utility is a professional-grade tool designed to bridge the gap between human-readable **GLOB patterns** (commonly used in file systems) and machine-executable **JavaScript Regular Expressions (RegExp)**.
|
|
4
|
+
|
|
5
|
+
Whether you are building a file explorer, a routing system, or a search filter, GlobMaster makes pattern matching intuitive and powerful.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## ✨ Core Features
|
|
10
|
+
|
|
11
|
+
GlobMaster supports the most essential GLOB syntax used in modern development:
|
|
12
|
+
|
|
13
|
+
* `*` : Matches any characters **except** path separators (`/`).
|
|
14
|
+
* `**` : Matches any characters **including** path separators (useful for recursive directory matching).
|
|
15
|
+
* `?` : Matches exactly one single character (excluding path separators).
|
|
16
|
+
* `[...]` : Matches any one of the characters inside the brackets.
|
|
17
|
+
* `[!...]` : Negated character class (matches any character **not** inside the brackets).
|
|
18
|
+
* `{a,b}` : Alternation (matches `a`, `b`, or `c`).
|
|
19
|
+
* `\` : Escape character to treat special symbols as literal characters.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🛠 API Reference
|
|
24
|
+
|
|
25
|
+
### 1. `compileGlob`
|
|
26
|
+
Converts a GLOB pattern into an array of regex-ready strings.
|
|
27
|
+
|
|
28
|
+
**Signature:**
|
|
29
|
+
```javascript
|
|
30
|
+
export const compileGlob(globData, strict = true);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Parameters:**
|
|
34
|
+
| Parameter | Type | Default | Description |
|
|
35
|
+
| :--- | :--- | :--- | :--- |
|
|
36
|
+
| `globData` | `string \| string[]` | Required | The pattern to compile. Can be a single string or an array of strings. |
|
|
37
|
+
| `strict` | `boolean` | `true` | If `true`, throws a `SyntaxError` for unmatched brackets `[` or braces `{`. |
|
|
38
|
+
|
|
39
|
+
**Returns:**
|
|
40
|
+
* `string[]`: An array of strings representing the components of the compiled Regular Expression.
|
|
41
|
+
|
|
42
|
+
**Errors:**
|
|
43
|
+
* `TypeError`: If `globData` is not a string or array of strings, or if `strict` is not a boolean.
|
|
44
|
+
* `SyntaxError`: If `strict` is enabled and the pattern has unbalanced syntax.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### 2. `compileGlobRegExp`
|
|
49
|
+
The most common method. Converts a GLOB pattern directly into a functional `RegExp` object.
|
|
50
|
+
|
|
51
|
+
**Signature:**
|
|
52
|
+
```javascript
|
|
53
|
+
export const compileGlobRegExp(globPattern, flags = '', strict = true);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Parameters:**
|
|
57
|
+
| Parameter | Type | Default | Description |
|
|
58
|
+
| :--- | :--- | :--- | :--- |
|
|
59
|
+
| `globPattern` | `string` | Required | The GLOB pattern to convert. |
|
|
60
|
+
| `flags` | `string` | `''` | Standard RegExp flags (e.g., `'i'` for case-insensitive). |
|
|
61
|
+
| `strict` | `boolean` | `true` | If `true`, performs strict syntax validation. |
|
|
62
|
+
|
|
63
|
+
**Returns:**
|
|
64
|
+
* `RegExp`: A ready-to-use Regular Expression object.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### 3. `decompileGlob`
|
|
69
|
+
The inverse of the compiler. It takes a `RegExp` and reconstructs the original GLOB pattern.
|
|
70
|
+
|
|
71
|
+
**Signature:**
|
|
72
|
+
```javascript
|
|
73
|
+
export const decompileGlob(regexp);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Parameters:**
|
|
77
|
+
| Parameter | Type | Description |
|
|
78
|
+
| :--- | :--- | :--- |
|
|
79
|
+
| `regexp` | `RegExp \| string \| string[]` | The pattern to decompile. |
|
|
80
|
+
|
|
81
|
+
**Returns:**
|
|
82
|
+
* `string[]`: An array containing the reconstructed GLOB pattern components.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### 4. `isValidGlob`
|
|
87
|
+
A lightweight way to check if a pattern is syntactically correct without needing to handle errors manually.
|
|
88
|
+
|
|
89
|
+
**Signature:**
|
|
90
|
+
```javascript
|
|
91
|
+
export const isValidGlob(globPattern);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Returns:**
|
|
95
|
+
* `boolean`: `true` if the pattern is valid, `false` if there is a syntax error.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 💡 Daily Workflow Examples
|
|
100
|
+
|
|
101
|
+
Here is how you will use this project in your day-to-day development.
|
|
102
|
+
|
|
103
|
+
### Scenario A: Filtering Files in a Directory
|
|
104
|
+
If you want to find all `.js` files in any subfolder:
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
import { compileGlobRegExp } from 'tiny-essentials/regexp/Glob';
|
|
108
|
+
|
|
109
|
+
const pattern = compileGlobRegExp('**/*.js');
|
|
110
|
+
const files = ['src/index.js', 'README.md', 'lib/utils/math.js', 'config.json'];
|
|
111
|
+
|
|
112
|
+
const matches = files.filter(file => pattern.test(file));
|
|
113
|
+
|
|
114
|
+
console.log(matches);
|
|
115
|
+
// Output: ['src/index.js', 'lib/utils/math.js']
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Scenario B: Validating User Input
|
|
119
|
+
When a user types a search pattern, you want to ensure they didn't break the syntax before processing it.
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
import { isValidGlob } from 'tiny-essentials/regexp/Glob';
|
|
123
|
+
|
|
124
|
+
const userInput = "src/[a-z{"; // This is invalid due to the unclosed brace
|
|
125
|
+
|
|
126
|
+
if (isValidGlob(userInput)) {
|
|
127
|
+
console.log("Pattern is valid! Proceeding...");
|
|
128
|
+
} else {
|
|
129
|
+
console.error("Invalid pattern detected. Please check your brackets.");
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Scenario C: Converting Regex back to Human-Readable GLOB
|
|
134
|
+
If you have a complex Regex and want to display its "human" version in a UI:
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
import { decompileGlob } from 'tiny-essentials/regexp/Glob';
|
|
138
|
+
|
|
139
|
+
const myRegex = /^src\/.*\.js$/;
|
|
140
|
+
const humanPattern = decompileGlob(myRegex);
|
|
141
|
+
|
|
142
|
+
console.log(humanPattern.join(''));
|
|
143
|
+
// Output: "src/*.js"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## ⚠️ Error Handling Guide
|
|
149
|
+
|
|
150
|
+
To ensure your application doesn't crash, always wrap your compilation in a `try...catch` block if you are dealing with dynamic user input.
|
|
151
|
+
|
|
152
|
+
| Error Type | Cause |
|
|
153
|
+
| :--- | :--- |
|
|
154
|
+
| `TypeError` | You passed a number, object (not array), or null where a string was expected. |
|
|
155
|
+
| `SyntaxError` | (In strict mode) You have an opening `[` or `{` without a closing counterpart. |
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# 🌐 IPv4 Utility Library
|
|
2
|
+
|
|
3
|
+
A lightweight, high-performance JavaScript module designed to validate and extract IPv4 addresses. This library is ideal for form validation, log parsing, and network security filtering.
|
|
4
|
+
|
|
5
|
+
## 🚀 Overview
|
|
6
|
+
|
|
7
|
+
This project provides tools to handle IPv4 addresses using highly optimized Regular Expressions. It distinguishes between **exact validation** (checking if a string is strictly an IP) and **extraction** (finding IPs within a large block of text).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🛠️ API Reference
|
|
12
|
+
|
|
13
|
+
### `isValidIPv4(s)`
|
|
14
|
+
Validates if a string is a correctly formatted IPv4 address.
|
|
15
|
+
|
|
16
|
+
* **Parameters:**
|
|
17
|
+
* `s` (`string`): The input string to be validated.
|
|
18
|
+
* **Returns:**
|
|
19
|
+
* `boolean`: `true` if the string is a valid IPv4 address, `false` otherwise.
|
|
20
|
+
* **Throws:**
|
|
21
|
+
* `TypeError`: If the input `s` is not a string.
|
|
22
|
+
|
|
23
|
+
**Example Usage:**
|
|
24
|
+
```javascript
|
|
25
|
+
import { isValidIPv4 } from 'tiny-essentials/regexp/Ipv4';
|
|
26
|
+
|
|
27
|
+
console.log(isValidIPv4('192.168.1.1')); // 🟢 true
|
|
28
|
+
console.log(isValidIPv4('256.0.0.1')); // 🔴 false (256 is out of range)
|
|
29
|
+
console.log(isValidIPv4('192.168.1')); // 🔴 false (missing octet)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### `extractIPsV4(text)`
|
|
35
|
+
Scans a block of text and retrieves all IPv4 addresses found within it.
|
|
36
|
+
|
|
37
|
+
* **Parameters:**
|
|
38
|
+
* `text` (`string`): The text content to search.
|
|
39
|
+
* **Returns:**
|
|
40
|
+
* `string[]`: An array of all matched IP addresses. Returns an empty array `[]` if no matches are found.
|
|
41
|
+
* **Throws:**
|
|
42
|
+
* `TypeError`: If the input `text` is not a string.
|
|
43
|
+
|
|
44
|
+
**Example Usage:**
|
|
45
|
+
```javascript
|
|
46
|
+
import { extractIPsV4 } from 'tiny-essentials/regexp/Ipv4';
|
|
47
|
+
|
|
48
|
+
const logData = "Error from 10.0.0.1 and connection lost at 192.168.0.100";
|
|
49
|
+
const ips = extractIPsV4(logData);
|
|
50
|
+
|
|
51
|
+
console.log(ips); // 📋 ["10.0.0.1", "192.168.0.100"]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### `ipv4Regex()`
|
|
57
|
+
Returns a `RegExp` object for exact matching.
|
|
58
|
+
|
|
59
|
+
* **Returns:**
|
|
60
|
+
* `RegExp`: A regex pattern that matches exactly four octets (0-255) separated by dots.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### `findIPv4Regex()`
|
|
65
|
+
Returns a global `RegExp` object for finding multiple matches.
|
|
66
|
+
|
|
67
|
+
* **Returns:**
|
|
68
|
+
* `RegExp`: A global (`g`) regex pattern using word boundaries (`\b`) to ensure it only matches complete IP addresses.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 💡 Practical Use Cases
|
|
73
|
+
|
|
74
|
+
### 1. 📝 Frontend: Form Validation
|
|
75
|
+
When a user enters their IP address in a configuration field, you want to ensure it is valid before sending it to the server.
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
const userInput = document.querySelector('#ip-input').value;
|
|
79
|
+
|
|
80
|
+
if (isValidIPv4(userInput)) {
|
|
81
|
+
// Proceed with API call
|
|
82
|
+
submitConfig(userInput);
|
|
83
|
+
} else {
|
|
84
|
+
// Show error to user
|
|
85
|
+
showError("Please enter a valid IPv4 address (e.g., 192.168.1.1)");
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 2. 🔍 Backend/DevOps: Log Analysis
|
|
90
|
+
If you are processing server logs to find which IP addresses are causing errors.
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
import { extractIPsV4 } from 'tiny-essentials/regexp/Ipv4';
|
|
94
|
+
|
|
95
|
+
const serverLogs = `
|
|
96
|
+
[2023-10-01 10:00] INFO: User 172.16.254.1 logged in.
|
|
97
|
+
[2023-10-01 10:05] WARN: Failed attempt from 10.5.5.5.
|
|
98
|
+
[2023-10-01 10:10] ERROR: Connection dropped by 192.168.1.1.
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
const maliciousIPs = extractIPsV4(serverLogs);
|
|
102
|
+
console.log(`Found ${maliciousIPs.length} IP addresses in logs.`);
|
|
103
|
+
```
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# 🌐 IPv6 Utility Library
|
|
2
|
+
|
|
3
|
+
A lightweight JavaScript utility for validating and extracting IPv6 addresses using optimized Regular Expressions.
|
|
4
|
+
|
|
5
|
+
## 📖 Overview
|
|
6
|
+
|
|
7
|
+
This library provides essential tools for developers working with networking data. It allows you to:
|
|
8
|
+
1. **Validate** if a specific string is a correctly formatted IPv6 address.
|
|
9
|
+
2. **Extract** all IPv6 addresses found within a larger block of text (such as log files or network reports).
|
|
10
|
+
3. **Access** the underlying Regular Expressions for custom implementations.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 🚀 Getting Started
|
|
15
|
+
|
|
16
|
+
### Installation
|
|
17
|
+
Since this library uses **ES6 Modules**, ensure your project is configured to support them. You can import the functions directly into your JavaScript files:
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
import { isValidIPv6, extractIPsV6, ipv6Regex, findIPv6Regex } from 'tiny-essentials/regexp/Ipv6';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 🛠 API Reference
|
|
26
|
+
|
|
27
|
+
### `isValidIPv6(s)`
|
|
28
|
+
Checks if the provided string is a valid IPv6 address.
|
|
29
|
+
|
|
30
|
+
* **Parameters:**
|
|
31
|
+
* `s` (`string`): The input string to be validated.
|
|
32
|
+
* **Returns:**
|
|
33
|
+
* `boolean`: Returns `true` if the string is a valid IPv6 address, otherwise `false`.
|
|
34
|
+
* **Throws:**
|
|
35
|
+
* `TypeError`: If the input `s` is not a string.
|
|
36
|
+
|
|
37
|
+
### `extractIPsV6(text)`
|
|
38
|
+
Scans a string and returns all IPv6 addresses found within it.
|
|
39
|
+
|
|
40
|
+
* **Parameters:**
|
|
41
|
+
* `text` (`string`): The text content to search through.
|
|
42
|
+
* **Returns:**
|
|
43
|
+
* `string[]`: An array containing all matched IPv6 addresses. Returns an empty array `[]` if no matches are found.
|
|
44
|
+
* **Throws:**
|
|
45
|
+
* `TypeError`: If the input `text` is not a string.
|
|
46
|
+
|
|
47
|
+
### `ipv6Regex()`
|
|
48
|
+
Generates a strict Regular Expression for IPv6 validation.
|
|
49
|
+
|
|
50
|
+
* **Returns:**
|
|
51
|
+
* `RegExp`: A regex object anchored with `^` and `$` to ensure the entire string is checked.
|
|
52
|
+
|
|
53
|
+
### `findIPv6Regex()`
|
|
54
|
+
Generates a global Regular Expression for searching.
|
|
55
|
+
|
|
56
|
+
* **Returns:**
|
|
57
|
+
* `RegExp`: A regex object with the `g` (global) flag, useful for finding multiple occurrences in a text.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 💡 Practical Examples
|
|
62
|
+
|
|
63
|
+
### 1. Validating User Input
|
|
64
|
+
Use `isValidIPv6` to verify data entered by a user in a network configuration form.
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
import { isValidIPv6 } from 'tiny-essentials/regexp/Ipv6';
|
|
68
|
+
|
|
69
|
+
const userInput = "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
|
|
70
|
+
|
|
71
|
+
if (isValidIPv6(userInput)) {
|
|
72
|
+
console.log("✅ Valid IPv6 address.");
|
|
73
|
+
} else {
|
|
74
|
+
console.log("❌ Invalid IPv6 address.");
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2. Parsing Log Files
|
|
79
|
+
Use `extractIPsV6` to quickly grab all IP addresses from a server log file.
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
import { extractIPsV6 } from 'tiny-essentials/regexp/Ipv6';
|
|
83
|
+
|
|
84
|
+
const logData = `
|
|
85
|
+
[2025-01-01 10:00] Connection from 2001:db8::1
|
|
86
|
+
[2025-01-01 10:05] Connection from fe80::ff00:43:ff:fe12:3456
|
|
87
|
+
[2025-01-01 10:10] Unknown error from 192.168.1.1
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
const foundIPs = extractIPsV6(logData);
|
|
91
|
+
|
|
92
|
+
console.log("Detected IPv6 addresses:", foundIPs);
|
|
93
|
+
// Output: ["2001:db8::1", "fe80::ff00:43:ff:fe12:3456"]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## ⚠️ Error Handling
|
|
99
|
+
|
|
100
|
+
The library implements strict type checking to prevent bugs in your application. If you pass a non-string value (like `null`, `undefined`, or a `number`) to the primary functions, the library will throw a `TypeError`.
|
|
101
|
+
|
|
102
|
+
**Example of error handling:**
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
import { isValidIPv6 } from 'tiny-essentials/regexp/Ipv6';
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
isValidIPv6(12345); // This will trigger the error
|
|
109
|
+
} catch (error) {
|
|
110
|
+
if (error instanceof TypeError) {
|
|
111
|
+
console.error("⚠️ Error: " + error.message);
|
|
112
|
+
// Output: "⚠️ Error: The input must be a string."
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## ⚙️ Technical Implementation Details
|
|
120
|
+
|
|
121
|
+
* **Regex Logic:** The library uses a specialized pattern that accounts for standard IPv6 formats and **zero compression** (the `::` notation).
|
|
122
|
+
* **Complexity Note:** While IPv4 validation is straightforward, this implementation handles the hexadecimal complexity and variable group lengths required for IPv6.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# 🛠️ Path Segment Extractor Utility
|
|
2
|
+
|
|
3
|
+
Welcome to the documentation for the **Path Segment Extractor**. This utility is a powerful, lightweight factory designed to transform string-based path patterns (like `/user/:id`) into highly efficient regular expressions capable of extracting dynamic parameters from URLs.
|
|
4
|
+
|
|
5
|
+
If you are building a custom router or a URL parser, this tool is your best friend! 🚀
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📖 Overview
|
|
10
|
+
|
|
11
|
+
The core logic relies on a **Factory Pattern**. Instead of creating a regex manually every time, you use `makeSegmentExtractor` to define *how* a dynamic segment looks (e.g., is it prefixed with a colon `:` or wrapped in curly braces `{}`?). Once defined, you can generate multiple "extractors" for different route patterns.
|
|
12
|
+
|
|
13
|
+
### 🌟 Key Features
|
|
14
|
+
* ✅ **Highly Customizable**: Define your own syntax for dynamic segments.
|
|
15
|
+
* ✅ **Type Safe**: Strict runtime validation ensures you don't pass incorrect data types.
|
|
16
|
+
* ✅ **Performant**: Compiles patterns into optimized `RegExp` objects.
|
|
17
|
+
* ✅ **URL Decoded**: Automatically handles `decodeURIComponent` for extracted parameters.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🚀 Quick Start
|
|
22
|
+
|
|
23
|
+
The easiest way to use this library is via the pre-configured `segmentExtractorV1`, which supports the standard `:paramName` syntax used by frameworks like Express.js.
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
import { segmentExtractorV1 } from 'tiny-essentials/regexp/SegmentExtractor';
|
|
27
|
+
|
|
28
|
+
// 1. Define your pattern
|
|
29
|
+
const userRoute = segmentExtractorV1('/user/:id/posts/:postId');
|
|
30
|
+
|
|
31
|
+
// 2. Test a real path
|
|
32
|
+
const result = userRoute.exec('/user/yasmin/posts/42');
|
|
33
|
+
|
|
34
|
+
if (result.match) {
|
|
35
|
+
console.log('✅ Match found!');
|
|
36
|
+
console.log('User ID:', result.params.id); // "yasmin"
|
|
37
|
+
console.log('Post ID:', result.params.postId); // "42"
|
|
38
|
+
} else {
|
|
39
|
+
console.log('❌ No match.');
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## ⚙️ API Reference
|
|
46
|
+
|
|
47
|
+
### `makeSegmentExtractor(searchValue, replaceValue, errorConfig)`
|
|
48
|
+
|
|
49
|
+
This is the main factory function.
|
|
50
|
+
|
|
51
|
+
| Parameter | Type | Description |
|
|
52
|
+
| :--- | :--- | :--- |
|
|
53
|
+
| `searchValue` | `string \| RegExp` | The pattern used to find dynamic segments in your string. |
|
|
54
|
+
| `replaceValue` | `Function` | A callback that transforms the found segment into a Regex capture group. |
|
|
55
|
+
| `errorConfig` | `Object` | Configuration for custom error messages. |
|
|
56
|
+
|
|
57
|
+
#### ⚠️ Errors Thrown
|
|
58
|
+
* `TypeError`: If `searchValue` is not a string/RegExp.
|
|
59
|
+
* `TypeError`: If `replaceValue` is not a function.
|
|
60
|
+
* `TypeError`: If `errorConfig` is missing or invalid.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### `segmentExtractorV1(pathPattern)`
|
|
65
|
+
|
|
66
|
+
A specialized version of the factory pre-configured for the `:name` syntax.
|
|
67
|
+
|
|
68
|
+
**Returns:** A `SegExResult` object.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🛠️ Advanced: Creating Custom Extractors
|
|
73
|
+
|
|
74
|
+
What if your project uses `{id}` instead of `:id`? You can create a custom extractor using `makeSegmentExtractor`.
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
import { makeSegmentExtractor } from 'tiny-essentials/regexp/SegmentExtractor';
|
|
78
|
+
|
|
79
|
+
// Define an extractor for {bracket} syntax
|
|
80
|
+
const bracketExtractor = makeSegmentExtractor(
|
|
81
|
+
/\{([^}]+)\}/g, // 1. Look for anything inside { }
|
|
82
|
+
(paramNames, _, paramName) => { // 2. Transform it
|
|
83
|
+
paramNames.push(paramName); // Store the name (e.g., "id")
|
|
84
|
+
return '([^}]+)'; // Return regex group (match everything inside)
|
|
85
|
+
},
|
|
86
|
+
{ pathPatternErrorMsg: 'Pattern must be a string!' }
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const route = bracketExtractor('/files/{fileId}');
|
|
90
|
+
const data = route.exec('/files/document_01.pdf');
|
|
91
|
+
|
|
92
|
+
console.log(data.params.fileId); // "document_01.pdf"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 📊 Data Structures
|
|
98
|
+
|
|
99
|
+
Understanding the returned objects is crucial for implementing the logic in your application.
|
|
100
|
+
|
|
101
|
+
### `SegExResult` (The Object returned by the extractor)
|
|
102
|
+
| Property | Type | Description |
|
|
103
|
+
| :--- | :--- | :--- |
|
|
104
|
+
| `regex` | `RegExp` | The compiled regular expression. |
|
|
105
|
+
| `paramNames` | `string[]` | An array of the names of the parameters found (in order). |
|
|
106
|
+
| `exec` | `Function` | The function used to perform the actual matching. |
|
|
107
|
+
|
|
108
|
+
### `SegExData` (The Object returned by `.exec()`)
|
|
109
|
+
| Property | Type | Description |
|
|
110
|
+
| :--- | :--- | :--- |
|
|
111
|
+
| `params` | `Record<string, string>` | A map where keys are parameter names and values are the extracted strings. |
|
|
112
|
+
| `match` | `boolean` | `true` if the path matched the pattern, `false` otherwise. |
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## 💡 Pro-Tips for Developers
|
|
117
|
+
|
|
118
|
+
1. **Reuse Extractors**: Do not call `segmentExtractorV1` inside a loop or a high-frequency function. Call it **once** at the top level to compile the regex, and then reuse the returned function. This is much faster! 🏎️
|
|
119
|
+
2. **Decoding**: The `exec` function automatically runs `decodeURIComponent`. This means `%20` in a URL will correctly become a space `" "` in your `params` object.
|
|
120
|
+
3. **Strictness**: The regex is wrapped in `^` and `$`. This means the path must match the pattern **exactly** from start to finish.
|