@vandenberghinc/volt 1.1.26 → 1.1.28
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/backend/dist/cjs/{blacklist.d.ts → backend/src/blacklist.d.ts} +5 -3
- package/backend/dist/cjs/{blacklist.js → backend/src/blacklist.js} +8 -5
- package/backend/dist/cjs/{cli.js → backend/src/cli.js} +29 -47
- package/backend/dist/cjs/backend/src/database/collection.d.ts +1543 -0
- package/backend/dist/cjs/backend/src/database/collection.js +3042 -0
- package/backend/dist/cjs/backend/src/database/database.d.ts +66 -0
- package/backend/dist/cjs/{database → backend/src/database}/database.js +48 -43
- package/backend/dist/cjs/backend/src/database/filters/filters.d.ts +6 -0
- package/backend/dist/cjs/backend/src/database/filters/filters.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter.d.ts +223 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.js +443 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.d.ts +165 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.js +355 -0
- package/backend/dist/cjs/backend/src/database/flatten.d.ts +75 -0
- package/backend/dist/cjs/{logger.js → backend/src/database/flatten.js} +18 -7
- package/backend/dist/cjs/backend/src/database/flatten_test.js +175 -0
- package/backend/dist/cjs/backend/src/database/quota/quota.d.ts +461 -0
- package/backend/dist/cjs/backend/src/database/quota/quota.js +1014 -0
- package/backend/dist/cjs/backend/src/database/quota/quota_v1.d.ts +534 -0
- package/backend/dist/cjs/backend/src/database/quota/quota_v1.js +1087 -0
- package/backend/dist/cjs/backend/src/database/quota/safe_int.d.ts +293 -0
- package/backend/dist/cjs/backend/src/database/quota/safe_int.js +573 -0
- package/backend/dist/{esm → cjs/backend/src}/endpoint.d.ts +69 -46
- package/backend/dist/cjs/{endpoint.js → backend/src/endpoint.js} +87 -101
- package/backend/dist/cjs/backend/src/errors/index.d.ts +7 -0
- package/backend/dist/cjs/backend/src/errors/index.js +25 -0
- package/backend/dist/{esm/utils.d.ts → cjs/backend/src/errors/internal_external.d.ts} +14 -22
- package/backend/dist/cjs/backend/src/errors/internal_external.js +85 -0
- package/backend/dist/cjs/backend/src/errors/invalid_usage_error.d.ts +38 -0
- package/backend/dist/cjs/{mutex.js → backend/src/errors/invalid_usage_error.js} +20 -37
- package/backend/dist/cjs/backend/src/errors/system_error.d.ts +230 -0
- package/backend/dist/cjs/backend/src/errors/system_error.js +393 -0
- package/backend/dist/cjs/backend/src/events.d.ts +54 -0
- package/backend/dist/cjs/backend/src/events.js +15 -0
- package/backend/dist/cjs/{frontend.js → backend/src/frontend.js} +1 -1
- package/backend/dist/cjs/{image_endpoint.d.ts → backend/src/image_endpoint.d.ts} +16 -1
- package/backend/dist/cjs/{image_endpoint.js → backend/src/image_endpoint.js} +3 -5
- package/backend/dist/cjs/backend/src/logger.d.ts +5 -0
- package/backend/dist/cjs/backend/src/logger.js +15 -0
- package/backend/dist/cjs/backend/src/meta.d.ts +64 -0
- package/backend/dist/cjs/{meta.js → backend/src/meta.js} +9 -12
- package/backend/dist/cjs/backend/src/payments/paddle.d.ts +326 -0
- package/backend/dist/cjs/{payments → backend/src/payments}/paddle.js +377 -327
- package/backend/dist/cjs/backend/src/plugins/browser.d.ts +1 -0
- package/backend/dist/cjs/backend/src/plugins/browser.js +15 -0
- package/backend/dist/cjs/backend/src/plugins/mail/mail.d.ts +248 -0
- package/backend/dist/cjs/backend/src/plugins/mail/mail.js +379 -0
- package/backend/dist/{esm → cjs/backend/src}/plugins/mail/ui.d.ts +23 -0
- package/backend/dist/cjs/backend/src/plugins/pdf.d.ts +1 -0
- package/backend/dist/cjs/backend/src/rate_limit.d.ts +145 -0
- package/backend/dist/cjs/backend/src/rate_limit.js +549 -0
- package/backend/dist/cjs/{route.d.ts → backend/src/route.d.ts} +3 -10
- package/backend/dist/cjs/{route.js → backend/src/route.js} +23 -21
- package/backend/dist/cjs/backend/src/server.d.ts +485 -0
- package/backend/dist/cjs/{server.js → backend/src/server.js} +688 -873
- package/backend/dist/cjs/backend/src/splash_screen.d.ts +80 -0
- package/backend/dist/cjs/{splash_screen.js → backend/src/splash_screen.js} +24 -3
- package/backend/dist/cjs/backend/src/status.d.ts +74 -0
- package/backend/dist/cjs/{status.js → backend/src/status.js} +64 -64
- package/backend/dist/cjs/backend/src/stream.d.ts +376 -0
- package/backend/dist/cjs/{stream.js → backend/src/stream.js} +299 -276
- package/backend/dist/cjs/backend/src/users.d.ts +807 -0
- package/backend/dist/cjs/backend/src/users.js +1971 -0
- package/backend/dist/cjs/backend/src/utils.d.ts +16 -0
- package/backend/dist/cjs/{utils.js → backend/src/utils.js} +14 -77
- package/backend/dist/{esm → cjs/backend/src}/view.d.ts +33 -11
- package/backend/dist/cjs/backend/src/view.js +508 -0
- package/backend/dist/{esm → cjs/backend/src}/volt.d.ts +10 -1
- package/backend/dist/cjs/{volt.js → backend/src/volt.js} +8 -5
- package/backend/dist/cjs/frontend/src/modules/request.d.ts +70 -0
- package/backend/dist/cjs/frontend/src/modules/request.js +99 -0
- package/backend/dist/esm/{blacklist.d.ts → backend/src/blacklist.d.ts} +5 -3
- package/backend/dist/esm/{blacklist.js → backend/src/blacklist.js} +9 -6
- package/backend/dist/esm/{cli.js → backend/src/cli.js} +43 -60
- package/backend/dist/esm/backend/src/database/collection.d.ts +1543 -0
- package/backend/dist/esm/backend/src/database/collection.js +3510 -0
- package/backend/dist/esm/backend/src/database/database.d.ts +66 -0
- package/backend/dist/esm/{database → backend/src/database}/database.js +62 -103
- package/backend/dist/esm/backend/src/database/document.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/document.js +558 -0
- package/backend/dist/esm/backend/src/database/filters/filters.d.ts +6 -0
- package/backend/dist/esm/backend/src/database/filters/filters.js +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter.d.ts +223 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter.js +3 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test.js +505 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.js +712 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.js +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.js +44 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.js +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.js +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter.d.ts +165 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter.js +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.js +405 -0
- package/backend/dist/esm/backend/src/database/flatten.d.ts +75 -0
- package/backend/dist/esm/backend/src/database/flatten.js +22 -0
- package/backend/dist/esm/backend/src/database/flatten_test.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/flatten_test.js +174 -0
- package/backend/dist/esm/backend/src/database/quota/quota.d.ts +461 -0
- package/backend/dist/esm/backend/src/database/quota/quota.js +1118 -0
- package/backend/dist/esm/backend/src/database/quota/quota_v1.d.ts +534 -0
- package/backend/dist/esm/backend/src/database/quota/quota_v1.js +1242 -0
- package/backend/dist/esm/backend/src/database/quota/safe_int.d.ts +293 -0
- package/backend/dist/esm/backend/src/database/quota/safe_int.js +602 -0
- package/backend/dist/{cjs → esm/backend/src}/endpoint.d.ts +69 -46
- package/backend/dist/esm/{endpoint.js → backend/src/endpoint.js} +136 -127
- package/backend/dist/esm/backend/src/errors/index.d.ts +7 -0
- package/backend/dist/esm/backend/src/errors/index.js +7 -0
- package/backend/dist/{cjs/utils.d.ts → esm/backend/src/errors/internal_external.d.ts} +14 -22
- package/backend/dist/esm/backend/src/errors/internal_external.js +70 -0
- package/backend/dist/esm/backend/src/errors/invalid_usage_error.d.ts +38 -0
- package/backend/dist/esm/backend/src/errors/invalid_usage_error.js +30 -0
- package/backend/dist/esm/backend/src/errors/system_error.d.ts +230 -0
- package/backend/dist/esm/backend/src/errors/system_error.js +402 -0
- package/backend/dist/esm/backend/src/events.d.ts +54 -0
- package/backend/dist/esm/backend/src/events.js +5 -0
- package/backend/dist/esm/{frontend.js → backend/src/frontend.js} +1 -1
- package/backend/dist/esm/{image_endpoint.d.ts → backend/src/image_endpoint.d.ts} +16 -1
- package/backend/dist/esm/{image_endpoint.js → backend/src/image_endpoint.js} +16 -20
- package/backend/dist/esm/backend/src/logger.d.ts +5 -0
- package/backend/dist/esm/backend/src/logger.js +8 -0
- package/backend/dist/esm/backend/src/meta.d.ts +64 -0
- package/backend/dist/esm/{meta.js → backend/src/meta.js} +15 -54
- package/backend/dist/esm/backend/src/payments/paddle.d.ts +326 -0
- package/backend/dist/esm/{payments → backend/src/payments}/paddle.js +417 -452
- package/backend/dist/esm/backend/src/plugins/browser.d.ts +1 -0
- package/backend/dist/esm/backend/src/plugins/browser.js +170 -0
- package/backend/dist/esm/backend/src/plugins/mail/mail.d.ts +248 -0
- package/backend/dist/esm/backend/src/plugins/mail/mail.js +389 -0
- package/backend/dist/{cjs → esm/backend/src}/plugins/mail/ui.d.ts +23 -0
- package/backend/dist/esm/{plugins → backend/src/plugins}/mail/ui.js +3 -6
- package/backend/dist/esm/backend/src/plugins/pdf.d.ts +1 -0
- package/backend/dist/esm/{plugins → backend/src/plugins}/pdf.js +3 -3
- package/backend/dist/esm/backend/src/rate_limit.d.ts +145 -0
- package/backend/dist/esm/backend/src/rate_limit.js +667 -0
- package/backend/dist/esm/{route.d.ts → backend/src/route.d.ts} +3 -10
- package/backend/dist/esm/{route.js → backend/src/route.js} +26 -21
- package/backend/dist/esm/backend/src/server.d.ts +485 -0
- package/backend/dist/esm/{server.js → backend/src/server.js} +891 -1441
- package/backend/dist/esm/backend/src/splash_screen.d.ts +80 -0
- package/backend/dist/esm/{splash_screen.js → backend/src/splash_screen.js} +42 -55
- package/backend/dist/esm/backend/src/status.d.ts +74 -0
- package/backend/dist/esm/backend/src/status.js +199 -0
- package/backend/dist/esm/backend/src/stream.d.ts +376 -0
- package/backend/dist/esm/{stream.js → backend/src/stream.js} +327 -292
- package/backend/dist/esm/backend/src/users.d.ts +809 -0
- package/backend/dist/esm/backend/src/users.js +2140 -0
- package/backend/dist/esm/backend/src/utils.d.ts +16 -0
- package/backend/dist/esm/{utils.js → backend/src/utils.js} +20 -81
- package/backend/dist/{cjs → esm/backend/src}/view.d.ts +33 -11
- package/backend/dist/esm/{view.js → backend/src/view.js} +266 -86
- package/backend/dist/{cjs → esm/backend/src}/volt.d.ts +10 -1
- package/backend/dist/esm/{volt.js → backend/src/volt.js} +7 -4
- package/backend/dist/esm/frontend/src/modules/request.d.ts +70 -0
- package/backend/dist/esm/frontend/src/modules/request.js +117 -0
- package/frontend/dist/backend/src/database/collection.d.ts +1543 -0
- package/frontend/dist/backend/src/database/collection.js +3510 -0
- package/frontend/dist/backend/src/database/database.d.ts +66 -0
- package/frontend/dist/backend/src/database/database.js +196 -0
- package/frontend/dist/backend/src/database/filters/filters.d.ts +6 -0
- package/frontend/dist/backend/src/database/filters/filters.js +1 -0
- package/frontend/dist/backend/src/database/filters/strict_filter.d.ts +223 -0
- package/frontend/dist/backend/src/database/filters/strict_filter.js +3 -0
- package/frontend/dist/backend/src/database/filters/strict_update_filter.d.ts +165 -0
- package/frontend/dist/backend/src/database/filters/strict_update_filter.js +5 -0
- package/frontend/dist/backend/src/database/flatten.d.ts +75 -0
- package/frontend/dist/backend/src/database/flatten.js +22 -0
- package/frontend/dist/backend/src/endpoint.d.ts +204 -0
- package/frontend/dist/backend/src/endpoint.js +570 -0
- package/frontend/dist/backend/src/errors/index.d.ts +7 -0
- package/frontend/dist/backend/src/errors/index.js +7 -0
- package/frontend/dist/backend/src/errors/internal_external.d.ts +38 -0
- package/frontend/dist/backend/src/errors/internal_external.js +70 -0
- package/frontend/dist/backend/src/errors/invalid_usage_error.d.ts +38 -0
- package/frontend/dist/backend/src/errors/invalid_usage_error.js +30 -0
- package/frontend/dist/backend/src/errors/system_error.d.ts +230 -0
- package/frontend/dist/backend/src/errors/system_error.js +402 -0
- package/frontend/dist/backend/src/events.d.ts +54 -0
- package/frontend/dist/backend/src/events.js +5 -0
- package/frontend/dist/backend/src/frontend.d.ts +11 -0
- package/frontend/dist/backend/src/frontend.js +12 -0
- package/frontend/dist/backend/src/image_endpoint.d.ts +39 -0
- package/frontend/dist/backend/src/image_endpoint.js +202 -0
- package/frontend/dist/backend/src/meta.d.ts +64 -0
- package/frontend/dist/backend/src/meta.js +110 -0
- package/frontend/dist/backend/src/payments/paddle.d.ts +326 -0
- package/frontend/dist/backend/src/payments/paddle.js +2256 -0
- package/frontend/dist/backend/src/plugins/mail/mail.d.ts +248 -0
- package/frontend/dist/backend/src/plugins/mail/mail.js +389 -0
- package/{backend/dist/esm/plugins/mail.d.ts → frontend/dist/backend/src/plugins/mail/ui.d.ts} +23 -0
- package/{backend/dist/esm/plugins/mail.js → frontend/dist/backend/src/plugins/mail/ui.js} +3 -6
- package/frontend/dist/backend/src/rate_limit.d.ts +145 -0
- package/frontend/dist/backend/src/rate_limit.js +673 -0
- package/frontend/dist/backend/src/route.d.ts +35 -0
- package/frontend/dist/backend/src/route.js +212 -0
- package/frontend/dist/backend/src/server.d.ts +485 -0
- package/frontend/dist/backend/src/server.js +2670 -0
- package/frontend/dist/backend/src/splash_screen.d.ts +80 -0
- package/frontend/dist/backend/src/splash_screen.js +135 -0
- package/frontend/dist/backend/src/status.d.ts +74 -0
- package/frontend/dist/backend/src/status.js +199 -0
- package/frontend/dist/backend/src/stream.d.ts +376 -0
- package/frontend/dist/backend/src/stream.js +1007 -0
- package/frontend/dist/backend/src/users.d.ts +807 -0
- package/frontend/dist/backend/src/users.js +2118 -0
- package/frontend/dist/backend/src/utils.d.ts +16 -0
- package/frontend/dist/backend/src/utils.js +241 -0
- package/frontend/dist/backend/src/view.d.ts +162 -0
- package/frontend/dist/backend/src/view.js +720 -0
- package/frontend/dist/frontend/src/elements/base.d.ts +4414 -0
- package/frontend/dist/{elements → frontend/src/elements}/base.js +3624 -260
- package/frontend/dist/frontend/src/elements/module.d.ts +95 -0
- package/frontend/dist/{elements → frontend/src/elements}/module.js +53 -52
- package/frontend/dist/frontend/src/elements/types.d.ts +52 -0
- package/frontend/dist/frontend/src/elements/types.js +5 -0
- package/frontend/dist/frontend/src/modules/attachment.d.ts +126 -0
- package/frontend/dist/frontend/src/modules/attachment.js +306 -0
- package/frontend/dist/frontend/src/modules/auth.d.ts +44 -0
- package/frontend/dist/frontend/src/modules/auth.js +80 -0
- package/frontend/dist/{modules → frontend/src/modules}/color.js +2 -2
- package/frontend/dist/frontend/src/modules/compression.d.ts +39 -0
- package/frontend/dist/frontend/src/modules/compression.js +102 -0
- package/frontend/dist/frontend/src/modules/cookies.d.ts +44 -0
- package/frontend/dist/frontend/src/modules/cookies.js +143 -0
- package/frontend/dist/frontend/src/modules/events.d.ts +31 -0
- package/frontend/dist/frontend/src/modules/events.js +74 -0
- package/frontend/dist/frontend/src/modules/google.d.ts +23 -0
- package/frontend/dist/frontend/src/modules/google.js +52 -0
- package/frontend/dist/frontend/src/modules/meta.d.ts +14 -0
- package/frontend/dist/{modules → frontend/src/modules}/meta.js +9 -7
- package/frontend/dist/{modules → frontend/src/modules}/paddle.d.ts +37 -134
- package/frontend/dist/{modules → frontend/src/modules}/paddle.js +620 -568
- package/frontend/dist/frontend/src/modules/request.d.ts +70 -0
- package/frontend/dist/frontend/src/modules/request.js +117 -0
- package/frontend/dist/frontend/src/modules/settings.d.ts +3 -0
- package/frontend/dist/frontend/src/modules/settings.js +5 -0
- package/frontend/dist/frontend/src/modules/statics.d.ts +21 -0
- package/frontend/dist/{modules → frontend/src/modules}/statics.js +15 -18
- package/frontend/dist/frontend/src/modules/support.d.ts +30 -0
- package/frontend/dist/frontend/src/modules/support.js +53 -0
- package/frontend/dist/{modules → frontend/src/modules}/theme.d.ts +67 -0
- package/frontend/dist/{modules → frontend/src/modules}/theme.js +68 -38
- package/frontend/dist/frontend/src/modules/themes.d.ts +12 -0
- package/frontend/dist/frontend/src/modules/themes.js +22 -0
- package/frontend/dist/frontend/src/modules/user.d.ts +164 -0
- package/frontend/dist/frontend/src/modules/user.js +268 -0
- package/frontend/dist/frontend/src/modules/utils.d.ts +176 -0
- package/frontend/dist/frontend/src/modules/utils.js +569 -0
- package/frontend/dist/frontend/src/types/gradient.d.ts +29 -0
- package/frontend/dist/{types → frontend/src/types}/gradient.js +14 -18
- package/frontend/dist/frontend/src/ui/border_button.d.ts +94 -0
- package/frontend/dist/{ui → frontend/src/ui}/border_button.js +7 -13
- package/frontend/dist/frontend/src/ui/button.d.ts +28 -0
- package/frontend/dist/{ui → frontend/src/ui}/button.js +21 -12
- package/frontend/dist/frontend/src/ui/canvas.d.ts +138 -0
- package/frontend/dist/{ui → frontend/src/ui}/canvas.js +88 -55
- package/frontend/dist/frontend/src/ui/checkbox.d.ts +74 -0
- package/frontend/dist/{ui → frontend/src/ui}/checkbox.js +80 -41
- package/frontend/dist/{ui → frontend/src/ui}/code.d.ts +73 -6
- package/frontend/dist/{ui → frontend/src/ui}/code.js +55 -52
- package/frontend/dist/{ui → frontend/src/ui}/context_menu.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/context_menu.js +12 -17
- package/frontend/dist/{ui → frontend/src/ui}/css.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/css.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/divider.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/divider.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/dropdown.d.ts +57 -2
- package/frontend/dist/{ui → frontend/src/ui}/dropdown.js +87 -94
- package/frontend/dist/{ui → frontend/src/ui}/for_each.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/for_each.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/form.d.ts +6 -2
- package/frontend/dist/{ui → frontend/src/ui}/form.js +10 -7
- package/frontend/dist/frontend/src/ui/frame_modes.d.ts +37 -0
- package/frontend/dist/{ui → frontend/src/ui}/frame_modes.js +16 -22
- package/frontend/dist/{ui → frontend/src/ui}/google_map.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/google_map.js +4 -4
- package/frontend/dist/{ui → frontend/src/ui}/gradient.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/gradient.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/image.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/image.js +5 -5
- package/frontend/dist/frontend/src/ui/input.d.ts +392 -0
- package/frontend/dist/{ui → frontend/src/ui}/input.js +346 -360
- package/frontend/dist/{ui → frontend/src/ui}/link.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/link.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/list.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/list.js +12 -6
- package/frontend/dist/frontend/src/ui/loader_button.d.ts +80 -0
- package/frontend/dist/{ui → frontend/src/ui}/loader_button.js +35 -47
- package/frontend/dist/frontend/src/ui/loaders.d.ts +57 -0
- package/frontend/dist/{ui → frontend/src/ui}/loaders.js +11 -11
- package/frontend/dist/{ui → frontend/src/ui}/popup.d.ts +11 -6
- package/frontend/dist/{ui → frontend/src/ui}/popup.js +32 -18
- package/frontend/dist/frontend/src/ui/pseudo.d.ts +44 -0
- package/frontend/dist/{ui → frontend/src/ui}/pseudo.js +84 -8
- package/frontend/dist/{ui → frontend/src/ui}/scroller.d.ts +14 -2
- package/frontend/dist/{ui → frontend/src/ui}/scroller.js +37 -43
- package/frontend/dist/{ui → frontend/src/ui}/slider.d.ts +5 -1
- package/frontend/dist/{ui → frontend/src/ui}/slider.js +4 -4
- package/frontend/dist/{ui → frontend/src/ui}/spacer.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/spacer.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/span.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/span.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/stack.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/stack.js +3 -9
- package/frontend/dist/frontend/src/ui/steps.d.ts +131 -0
- package/frontend/dist/{ui → frontend/src/ui}/steps.js +30 -45
- package/frontend/dist/{ui → frontend/src/ui}/style.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/style.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/switch.d.ts +5 -1
- package/frontend/dist/{ui → frontend/src/ui}/switch.js +4 -4
- package/frontend/dist/{ui → frontend/src/ui}/table.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/table.js +6 -6
- package/frontend/dist/{ui → frontend/src/ui}/tabs.d.ts +45 -3
- package/frontend/dist/{ui → frontend/src/ui}/tabs.js +65 -40
- package/frontend/dist/{ui → frontend/src/ui}/text.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/text.js +3 -3
- package/frontend/dist/frontend/src/ui/title.d.ts +91 -0
- package/frontend/dist/frontend/src/ui/title.js +272 -0
- package/frontend/dist/{ui → frontend/src/ui}/view.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/view.js +3 -3
- package/frontend/dist/{volt.d.ts → frontend/src/volt.d.ts} +3 -0
- package/frontend/dist/{volt.js → frontend/src/volt.js} +4 -0
- package/frontend/tools/bundle_d_ts.js +71 -0
- package/frontend/tools/convert_to_jsdoc_input.txt +9452 -0
- package/frontend/tools/convert_to_jsdoc_output.txt +7626 -0
- package/frontend/tools/convert_to_jsdoc_tmp.js +345 -0
- package/package.json +11 -12
- package/backend/dist/cjs/database/collection.d.ts +0 -160
- package/backend/dist/cjs/database/collection.js +0 -842
- package/backend/dist/cjs/database/database.d.ts +0 -121
- package/backend/dist/cjs/database/document.d.ts +0 -131
- package/backend/dist/cjs/database/document.js +0 -224
- package/backend/dist/cjs/database.d.ts +0 -502
- package/backend/dist/cjs/database.js +0 -2248
- package/backend/dist/cjs/logger.d.ts +0 -3
- package/backend/dist/cjs/meta.d.ts +0 -50
- package/backend/dist/cjs/mutex.d.ts +0 -24
- package/backend/dist/cjs/payments/paddle.d.ts +0 -160
- package/backend/dist/cjs/plugins/browser.d.ts +0 -36
- package/backend/dist/cjs/plugins/browser.js +0 -198
- package/backend/dist/cjs/plugins/css.d.ts +0 -11
- package/backend/dist/cjs/plugins/css.js +0 -80
- package/backend/dist/cjs/plugins/mail.d.ts +0 -277
- package/backend/dist/cjs/plugins/mail.js +0 -1370
- package/backend/dist/cjs/plugins/ts/compiler.d.ts +0 -139
- package/backend/dist/cjs/plugins/ts/compiler.js +0 -750
- package/backend/dist/cjs/plugins/ts/preprocessing.d.ts +0 -14
- package/backend/dist/cjs/plugins/ts/preprocessing.js +0 -440
- package/backend/dist/cjs/rate_limit.d.ts +0 -63
- package/backend/dist/cjs/rate_limit.js +0 -348
- package/backend/dist/cjs/request.deprc.d.ts +0 -48
- package/backend/dist/cjs/request.deprc.js +0 -572
- package/backend/dist/cjs/response.deprc.d.ts +0 -55
- package/backend/dist/cjs/response.deprc.js +0 -275
- package/backend/dist/cjs/server.d.ts +0 -342
- package/backend/dist/cjs/splash_screen.d.ts +0 -35
- package/backend/dist/cjs/status.d.ts +0 -61
- package/backend/dist/cjs/stream.d.ts +0 -79
- package/backend/dist/cjs/users.d.ts +0 -111
- package/backend/dist/cjs/users.js +0 -1817
- package/backend/dist/cjs/view.js +0 -352
- package/backend/dist/cjs/vinc.dev.d.ts +0 -3
- package/backend/dist/cjs/vinc.dev.js +0 -7
- package/backend/dist/css/adyen.css +0 -92
- package/backend/dist/css/volt.css +0 -70
- package/backend/dist/esm/database/collection.d.ts +0 -160
- package/backend/dist/esm/database/collection.js +0 -1328
- package/backend/dist/esm/database/database.d.ts +0 -121
- package/backend/dist/esm/database/document.d.ts +0 -131
- package/backend/dist/esm/database/document.js +0 -247
- package/backend/dist/esm/database.d.ts +0 -502
- package/backend/dist/esm/database.js +0 -2423
- package/backend/dist/esm/file_watcher.js +0 -329
- package/backend/dist/esm/logger.d.ts +0 -3
- package/backend/dist/esm/logger.js +0 -11
- package/backend/dist/esm/meta.d.ts +0 -50
- package/backend/dist/esm/mutex.d.ts +0 -24
- package/backend/dist/esm/mutex.js +0 -48
- package/backend/dist/esm/payments/paddle.d.ts +0 -160
- package/backend/dist/esm/plugins/browser.d.ts +0 -36
- package/backend/dist/esm/plugins/browser.js +0 -176
- package/backend/dist/esm/plugins/css.d.ts +0 -11
- package/backend/dist/esm/plugins/css.js +0 -90
- package/backend/dist/esm/plugins/ts/compiler.d.ts +0 -139
- package/backend/dist/esm/plugins/ts/compiler.js +0 -1194
- package/backend/dist/esm/plugins/ts/preprocessing.d.ts +0 -14
- package/backend/dist/esm/plugins/ts/preprocessing.js +0 -726
- package/backend/dist/esm/rate_limit.d.ts +0 -63
- package/backend/dist/esm/rate_limit.js +0 -417
- package/backend/dist/esm/request.deprc.d.ts +0 -48
- package/backend/dist/esm/request.deprc.js +0 -572
- package/backend/dist/esm/response.deprc.d.ts +0 -55
- package/backend/dist/esm/response.deprc.js +0 -275
- package/backend/dist/esm/server.d.ts +0 -342
- package/backend/dist/esm/splash_screen.d.ts +0 -35
- package/backend/dist/esm/status.d.ts +0 -61
- package/backend/dist/esm/status.js +0 -197
- package/backend/dist/esm/stream.d.ts +0 -79
- package/backend/dist/esm/users.d.ts +0 -111
- package/backend/dist/esm/users.js +0 -1935
- package/backend/dist/esm/vinc.dev.d.ts +0 -3
- package/backend/dist/esm/vinc.dev.js +0 -7
- package/frontend/dist/elements/base.d.ts +0 -9889
- package/frontend/dist/elements/module.d.ts +0 -30
- package/frontend/dist/modules/array.d.ts +0 -94
- package/frontend/dist/modules/array.js +0 -634
- package/frontend/dist/modules/auth.d.ts +0 -46
- package/frontend/dist/modules/auth.js +0 -139
- package/frontend/dist/modules/colors.d.ts +0 -1
- package/frontend/dist/modules/colors.js +0 -417
- package/frontend/dist/modules/compression.d.ts +0 -6
- package/frontend/dist/modules/compression.js +0 -999
- package/frontend/dist/modules/cookies.d.ts +0 -18
- package/frontend/dist/modules/cookies.js +0 -167
- package/frontend/dist/modules/date.d.ts +0 -142
- package/frontend/dist/modules/date.js +0 -493
- package/frontend/dist/modules/events.d.ts +0 -8
- package/frontend/dist/modules/events.js +0 -91
- package/frontend/dist/modules/google.d.ts +0 -11
- package/frontend/dist/modules/google.js +0 -54
- package/frontend/dist/modules/meta.d.ts +0 -10
- package/frontend/dist/modules/mutex.d.ts +0 -7
- package/frontend/dist/modules/mutex.js +0 -51
- package/frontend/dist/modules/number.d.ts +0 -16
- package/frontend/dist/modules/number.js +0 -23
- package/frontend/dist/modules/object.d.ts +0 -52
- package/frontend/dist/modules/object.js +0 -383
- package/frontend/dist/modules/scheme.d.ts +0 -227
- package/frontend/dist/modules/scheme.js +0 -531
- package/frontend/dist/modules/settings.d.ts +0 -3
- package/frontend/dist/modules/settings.js +0 -4
- package/frontend/dist/modules/statics.d.ts +0 -5
- package/frontend/dist/modules/string.d.ts +0 -124
- package/frontend/dist/modules/string.js +0 -745
- package/frontend/dist/modules/support.d.ts +0 -19
- package/frontend/dist/modules/support.js +0 -103
- package/frontend/dist/modules/themes.d.ts +0 -8
- package/frontend/dist/modules/themes.js +0 -18
- package/frontend/dist/modules/user.d.ts +0 -59
- package/frontend/dist/modules/user.js +0 -280
- package/frontend/dist/modules/utils.d.ts +0 -87
- package/frontend/dist/modules/utils.js +0 -923
- package/frontend/dist/types/gradient.d.ts +0 -12
- package/frontend/dist/ui/border_button.d.ts +0 -152
- package/frontend/dist/ui/button.d.ts +0 -21
- package/frontend/dist/ui/canvas.d.ts +0 -56
- package/frontend/dist/ui/checkbox.d.ts +0 -52
- package/frontend/dist/ui/frame_modes.d.ts +0 -25
- package/frontend/dist/ui/input.d.ts +0 -241
- package/frontend/dist/ui/loader_button.d.ts +0 -93
- package/frontend/dist/ui/loaders.d.ts +0 -57
- package/frontend/dist/ui/pseudo.d.ts +0 -16
- package/frontend/dist/ui/steps.d.ts +0 -59
- package/frontend/dist/ui/title.d.ts +0 -21
- package/frontend/dist/ui/title.js +0 -121
- package/frontend/examples/dashboard/dashboard.ts +0 -776
- /package/backend/dist/cjs/{cli.d.ts → backend/src/cli.d.ts} +0 -0
- /package/backend/dist/cjs/{file_watcher.d.ts → backend/src/database/document.d.ts} +0 -0
- /package/backend/dist/cjs/{file_watcher.js → backend/src/database/document.js} +0 -0
- /package/backend/dist/cjs/{plugins/pdf.d.ts → backend/src/database/filters/strict_filter_test.d.ts} +0 -0
- /package/backend/dist/{esm/file_watcher.d.ts → cjs/backend/src/database/filters/strict_filter_test_v0.d.ts} +0 -0
- /package/backend/dist/{esm/plugins/pdf.d.ts → cjs/backend/src/database/flatten_test.d.ts} +0 -0
- /package/backend/dist/cjs/{frontend.d.ts → backend/src/frontend.d.ts} +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/communication.d.ts +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/communication.js +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/mail/ui.js +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/pdf.js +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/thread_monitor.d.ts +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/thread_monitor.js +0 -0
- /package/backend/dist/cjs/{vinc.d.ts → backend/src/vinc.d.ts} +0 -0
- /package/backend/dist/cjs/{vinc.js → backend/src/vinc.js} +0 -0
- /package/backend/dist/esm/{cli.d.ts → backend/src/cli.d.ts} +0 -0
- /package/backend/dist/esm/{frontend.d.ts → backend/src/frontend.d.ts} +0 -0
- /package/backend/dist/esm/{plugins → backend/src/plugins}/communication.d.ts +0 -0
- /package/backend/dist/esm/{plugins → backend/src/plugins}/communication.js +0 -0
- /package/backend/dist/esm/{plugins → backend/src/plugins}/thread_monitor.d.ts +0 -0
- /package/backend/dist/esm/{plugins → backend/src/plugins}/thread_monitor.js +0 -0
- /package/backend/dist/esm/{vinc.d.ts → backend/src/vinc.d.ts} +0 -0
- /package/backend/dist/esm/{vinc.js → backend/src/vinc.js} +0 -0
- /package/frontend/dist/{elements → frontend/src/elements}/register_element.d.ts +0 -0
- /package/frontend/dist/{elements → frontend/src/elements}/register_element.js +0 -0
- /package/frontend/dist/{modules → frontend/src/modules}/color.d.ts +0 -0
- /package/frontend/dist/{ui → frontend/src/ui}/ui.d.ts +0 -0
- /package/frontend/dist/{ui → frontend/src/ui}/ui.js +0 -0
|
@@ -1,745 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Daan van den Bergh
|
|
3
|
-
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* @note FRONTEND - This file should also be accessable from the frontend.
|
|
6
|
-
*/
|
|
7
|
-
var StringUtils;
|
|
8
|
-
(function (StringUtils) {
|
|
9
|
-
/**
|
|
10
|
-
* Removes common indentation from multiline strings.
|
|
11
|
-
*/
|
|
12
|
-
function dedent(data, allow_empty_first_line = false) {
|
|
13
|
-
// Allow empty first line.
|
|
14
|
-
if (allow_empty_first_line) {
|
|
15
|
-
const line_break = data.indexOf("\n");
|
|
16
|
-
if (line_break !== -1) {
|
|
17
|
-
data = data.slice(line_break + 1);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
data = data.trimStart();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
// Split the string into lines.
|
|
24
|
-
const lines = data.split('\n');
|
|
25
|
-
// Find minimum indentation.
|
|
26
|
-
const indent = lines
|
|
27
|
-
.filter(line => line.trim())
|
|
28
|
-
.map(line => line.match(/^[ \t]*/)?.[0].length ?? Infinity)
|
|
29
|
-
.reduce((min, curr) => Math.min(min, curr), Infinity);
|
|
30
|
-
// Remove common indentation.
|
|
31
|
-
return lines
|
|
32
|
-
.map(line => line.slice(indent))
|
|
33
|
-
.join('\n')
|
|
34
|
-
.trim();
|
|
35
|
-
}
|
|
36
|
-
StringUtils.dedent = dedent;
|
|
37
|
-
/**
|
|
38
|
-
* Returns the first character of the string.
|
|
39
|
-
*/
|
|
40
|
-
function first(data) {
|
|
41
|
-
return data[0];
|
|
42
|
-
}
|
|
43
|
-
StringUtils.first = first;
|
|
44
|
-
/**
|
|
45
|
-
* Returns the last character of the string.
|
|
46
|
-
*/
|
|
47
|
-
function last(data) {
|
|
48
|
-
const s = data;
|
|
49
|
-
return s[s.length - 1];
|
|
50
|
-
}
|
|
51
|
-
StringUtils.last = last;
|
|
52
|
-
/**
|
|
53
|
-
* Gets the first non-whitespace character. Optionally ignores newline as whitespace.
|
|
54
|
-
*/
|
|
55
|
-
function first_non_whitespace(data, line_break = false) {
|
|
56
|
-
const s = data;
|
|
57
|
-
for (let i = 0; i < s.length; i++) {
|
|
58
|
-
const char = s.charAt(i);
|
|
59
|
-
if (char !== " " && char !== "\t" && (!line_break || char !== "\n")) {
|
|
60
|
-
return char;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
StringUtils.first_non_whitespace = first_non_whitespace;
|
|
66
|
-
/**
|
|
67
|
-
* Gets the last non-whitespace character. Optionally ignores newline as whitespace.
|
|
68
|
-
*/
|
|
69
|
-
function last_non_whitespace(data, line_break = false) {
|
|
70
|
-
const s = data;
|
|
71
|
-
for (let i = s.length - 1; i >= 0; i--) {
|
|
72
|
-
const char = s.charAt(i);
|
|
73
|
-
if (char !== " " && char !== "\t" && (!line_break || char !== "\n")) {
|
|
74
|
-
return char;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
StringUtils.last_non_whitespace = last_non_whitespace;
|
|
80
|
-
/**
|
|
81
|
-
* Gets the first character not in the exclude list, starting from an index.
|
|
82
|
-
*/
|
|
83
|
-
function first_not_of(data, exclude = [], start_index = 0) {
|
|
84
|
-
const s = data;
|
|
85
|
-
for (let i = start_index; i < s.length; i++) {
|
|
86
|
-
if (!exclude.includes(s.charAt(i)))
|
|
87
|
-
return s.charAt(i);
|
|
88
|
-
}
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
StringUtils.first_not_of = first_not_of;
|
|
92
|
-
/**
|
|
93
|
-
* Gets the index of the first character not in the exclude list, starting from an index.
|
|
94
|
-
*/
|
|
95
|
-
function first_index_not_of(data, exclude = [], start_index = 0) {
|
|
96
|
-
const s = data;
|
|
97
|
-
for (let i = start_index; i < s.length; i++) {
|
|
98
|
-
if (!exclude.includes(s.charAt(i)))
|
|
99
|
-
return i;
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
StringUtils.first_index_not_of = first_index_not_of;
|
|
104
|
-
/**
|
|
105
|
-
* Gets the last character not in the exclude list, searching backward.
|
|
106
|
-
*/
|
|
107
|
-
function last_not_of(data, exclude = [], start_index = -1) {
|
|
108
|
-
const s = data;
|
|
109
|
-
let idx = start_index === -1 || start_index == null ? s.length - 1 : start_index;
|
|
110
|
-
for (let i = idx; i >= 0; i--) {
|
|
111
|
-
if (!exclude.includes(s.charAt(i)))
|
|
112
|
-
return s.charAt(i);
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
StringUtils.last_not_of = last_not_of;
|
|
117
|
-
/**
|
|
118
|
-
* Gets the index of the last character not in the exclude list, searching backward.
|
|
119
|
-
*/
|
|
120
|
-
function last_index_not_of(data, exclude = [], start_index = -1) {
|
|
121
|
-
const s = data;
|
|
122
|
-
let idx = start_index === -1 || start_index == null ? s.length - 1 : start_index;
|
|
123
|
-
for (let i = idx; i >= 0; i--) {
|
|
124
|
-
if (!exclude.includes(s.charAt(i)))
|
|
125
|
-
return i;
|
|
126
|
-
}
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
StringUtils.last_index_not_of = last_index_not_of;
|
|
130
|
-
/**
|
|
131
|
-
* Inserts a substring at the given index.
|
|
132
|
-
*/
|
|
133
|
-
function insert(data, index, substr) {
|
|
134
|
-
const s = data;
|
|
135
|
-
return s.slice(0, index) + substr + s.slice(index);
|
|
136
|
-
}
|
|
137
|
-
StringUtils.insert = insert;
|
|
138
|
-
/**
|
|
139
|
-
* Removes characters between start and end indices.
|
|
140
|
-
*/
|
|
141
|
-
function remove_indices(data, start, end) {
|
|
142
|
-
const s = data;
|
|
143
|
-
return s.slice(0, start) + s.slice(end);
|
|
144
|
-
}
|
|
145
|
-
StringUtils.remove_indices = remove_indices;
|
|
146
|
-
/**
|
|
147
|
-
* Replaces characters between start and end indices with the given substring.
|
|
148
|
-
*/
|
|
149
|
-
function replace_indices(data, substr, start, end) {
|
|
150
|
-
const s = data;
|
|
151
|
-
return s.slice(0, start) + substr + s.slice(end);
|
|
152
|
-
}
|
|
153
|
-
StringUtils.replace_indices = replace_indices;
|
|
154
|
-
/**
|
|
155
|
-
* Checks if the string starts with the given substring at an optional index.
|
|
156
|
-
*/
|
|
157
|
-
function eq_first(data, substr, start_index = 0) {
|
|
158
|
-
const s = data;
|
|
159
|
-
if (start_index + substr.length > s.length)
|
|
160
|
-
return false;
|
|
161
|
-
return s.substr(start_index, substr.length) === substr;
|
|
162
|
-
}
|
|
163
|
-
StringUtils.eq_first = eq_first;
|
|
164
|
-
/**
|
|
165
|
-
* Checks if the string ends with the given substring.
|
|
166
|
-
*/
|
|
167
|
-
function eq_last(data, substr) {
|
|
168
|
-
const s = data;
|
|
169
|
-
if (substr.length > s.length)
|
|
170
|
-
return false;
|
|
171
|
-
return s.slice(s.length - substr.length) === substr;
|
|
172
|
-
}
|
|
173
|
-
StringUtils.eq_last = eq_last;
|
|
174
|
-
/**
|
|
175
|
-
* Ensures the string ends with one of the given characters, appending the first if not.
|
|
176
|
-
*/
|
|
177
|
-
function ensure_last(data, ensure_last) {
|
|
178
|
-
const s = data;
|
|
179
|
-
if (!ensure_last.includes(s.charAt(s.length - 1)))
|
|
180
|
-
return s + ensure_last.charAt(0);
|
|
181
|
-
return s;
|
|
182
|
-
}
|
|
183
|
-
StringUtils.ensure_last = ensure_last;
|
|
184
|
-
/**
|
|
185
|
-
* Returns true if all characters are uppercase (digits optional).
|
|
186
|
-
*/
|
|
187
|
-
function is_uppercase(data, allow_digits = false) {
|
|
188
|
-
let allowed = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
189
|
-
if (allow_digits)
|
|
190
|
-
allowed += "0123456789";
|
|
191
|
-
return [...data].every(c => allowed.includes(c));
|
|
192
|
-
}
|
|
193
|
-
StringUtils.is_uppercase = is_uppercase;
|
|
194
|
-
/**
|
|
195
|
-
* Capitalizes only the first letter of the string.
|
|
196
|
-
*/
|
|
197
|
-
function capitalize_word(data) {
|
|
198
|
-
const s = data;
|
|
199
|
-
if (/[a-z]/.test(s.charAt(0)))
|
|
200
|
-
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
201
|
-
return s;
|
|
202
|
-
}
|
|
203
|
-
StringUtils.capitalize_word = capitalize_word;
|
|
204
|
-
/**
|
|
205
|
-
* Capitalizes the first letter of each word separated by whitespace.
|
|
206
|
-
*/
|
|
207
|
-
function capitalize_words(data) {
|
|
208
|
-
return data.split(/(\s+)/).map(part => /^[a-z]/.test(part) ? part.charAt(0).toUpperCase() + part.slice(1) : part).join('');
|
|
209
|
-
}
|
|
210
|
-
StringUtils.capitalize_words = capitalize_words;
|
|
211
|
-
/**
|
|
212
|
-
* Removes all instances of the given character(s) from the string.
|
|
213
|
-
*/
|
|
214
|
-
function drop(data, char) {
|
|
215
|
-
const exclude = Array.isArray(char) ? char : [char];
|
|
216
|
-
return [...data].filter(c => !exclude.includes(c)).join('');
|
|
217
|
-
}
|
|
218
|
-
StringUtils.drop = drop;
|
|
219
|
-
/**
|
|
220
|
-
* Returns the reversed string.
|
|
221
|
-
*/
|
|
222
|
-
function reverse(data) {
|
|
223
|
-
return data.split('').reverse().join('');
|
|
224
|
-
}
|
|
225
|
-
StringUtils.reverse = reverse;
|
|
226
|
-
/**
|
|
227
|
-
* Generates a random alphanumeric string of the given length.
|
|
228
|
-
*/
|
|
229
|
-
function random(length = 32) {
|
|
230
|
-
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
231
|
-
let result = '';
|
|
232
|
-
for (let i = 0; i < length; i++)
|
|
233
|
-
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
234
|
-
return result;
|
|
235
|
-
}
|
|
236
|
-
StringUtils.random = random;
|
|
237
|
-
/**
|
|
238
|
-
* Returns true if the string contains only digits.
|
|
239
|
-
*/
|
|
240
|
-
function is_integer_string(data) {
|
|
241
|
-
return /^[0-9]+$/.test(data);
|
|
242
|
-
}
|
|
243
|
-
StringUtils.is_integer_string = is_integer_string;
|
|
244
|
-
/**
|
|
245
|
-
* Returns true if the string is a valid floating-point representation.
|
|
246
|
-
*/
|
|
247
|
-
function is_floating_string(data) {
|
|
248
|
-
return /^[0-9]*\.[0-9]+$/.test(data);
|
|
249
|
-
}
|
|
250
|
-
StringUtils.is_floating_string = is_floating_string;
|
|
251
|
-
/**
|
|
252
|
-
* Returns info or boolean about numeric string (integer/floating).
|
|
253
|
-
*/
|
|
254
|
-
function is_numeric_string(data, info = false) {
|
|
255
|
-
const s = data;
|
|
256
|
-
const integer = /^[0-9]+$/.test(s);
|
|
257
|
-
const floating = /^[0-9]*\.[0-9]+$/.test(s);
|
|
258
|
-
return info ? { integer, floating } : integer || floating;
|
|
259
|
-
}
|
|
260
|
-
StringUtils.is_numeric_string = is_numeric_string;
|
|
261
|
-
/**
|
|
262
|
-
* Removes matching quotes from the ends of the string.
|
|
263
|
-
*/
|
|
264
|
-
function unquote(data) {
|
|
265
|
-
const s = data;
|
|
266
|
-
if ((s.startsWith('"') && s.endsWith('"')) || (s.startsWith("'") && s.endsWith("'")))
|
|
267
|
-
return s.slice(1, -1);
|
|
268
|
-
return s;
|
|
269
|
-
}
|
|
270
|
-
StringUtils.unquote = unquote;
|
|
271
|
-
/**
|
|
272
|
-
* Wraps the string in quotes if not already quoted.
|
|
273
|
-
*/
|
|
274
|
-
function quote(data) {
|
|
275
|
-
const s = data;
|
|
276
|
-
if ((s.startsWith('"') && s.endsWith('"')) || (s.startsWith("'") && s.endsWith("'")))
|
|
277
|
-
return s;
|
|
278
|
-
return `"${s}"`;
|
|
279
|
-
}
|
|
280
|
-
StringUtils.quote = quote;
|
|
281
|
-
})(StringUtils || (StringUtils = {}));
|
|
282
|
-
export { StringUtils as String };
|
|
283
|
-
String.prototype.first = function () { return this[0]; };
|
|
284
|
-
String.prototype.last = function () { return this[this.length - 1]; };
|
|
285
|
-
String.prototype.dedent = function (allow_empty_first_line = false) { return StringUtils.dedent(this, allow_empty_first_line); };
|
|
286
|
-
// ---------------------------------------------------------------------------------------------
|
|
287
|
-
// OLD
|
|
288
|
-
// declare global {
|
|
289
|
-
// // String interface extensions
|
|
290
|
-
// interface String {
|
|
291
|
-
// /**
|
|
292
|
-
// * Returns the first character of the string.
|
|
293
|
-
// */
|
|
294
|
-
// first(): string | undefined;
|
|
295
|
-
// /**
|
|
296
|
-
// * Returns the last character of the string.
|
|
297
|
-
// */
|
|
298
|
-
// last(): string | undefined;
|
|
299
|
-
// /**
|
|
300
|
-
// * Gets the first non-whitespace character.
|
|
301
|
-
// * @param line_break Whether to consider line breaks as whitespace.
|
|
302
|
-
// * @returns The first non-whitespace character or null if none found.
|
|
303
|
-
// */
|
|
304
|
-
// first_non_whitespace(line_break?: boolean): string | null;
|
|
305
|
-
// /**
|
|
306
|
-
// * Gets the last non-whitespace character.
|
|
307
|
-
// * @param line_break Whether to consider line breaks as whitespace.
|
|
308
|
-
// * @returns The last non-whitespace character or null if none found.
|
|
309
|
-
// */
|
|
310
|
-
// last_non_whitespace(line_break?: boolean): string | null;
|
|
311
|
-
// /**
|
|
312
|
-
// * Finds the first character not in the exclude list.
|
|
313
|
-
// * @param exclude An array of characters to exclude.
|
|
314
|
-
// * @param start_index The index to start searching from.
|
|
315
|
-
// * @returns The first character not excluded or null if none found.
|
|
316
|
-
// */
|
|
317
|
-
// first_not_of(exclude: string[], start_index?: number): string | null;
|
|
318
|
-
// /**
|
|
319
|
-
// * Finds the index of the first character not in the exclude list.
|
|
320
|
-
// * @param exclude An array of characters to exclude.
|
|
321
|
-
// * @param start_index The index to start searching from.
|
|
322
|
-
// * @returns The index or null if none found.
|
|
323
|
-
// */
|
|
324
|
-
// first_index_not_of(exclude: string[], start_index?: number): number | null;
|
|
325
|
-
// /**
|
|
326
|
-
// * Finds the last character not in the exclude list.
|
|
327
|
-
// * @param exclude An array of characters to exclude.
|
|
328
|
-
// * @param start_index The index to start searching backwards from.
|
|
329
|
-
// * @returns The last character not excluded or null if none found.
|
|
330
|
-
// */
|
|
331
|
-
// last_not_of(exclude: string[], start_index?: number): string | null;
|
|
332
|
-
// /**
|
|
333
|
-
// * Finds the index of the last character not in the exclude list.
|
|
334
|
-
// * @param exclude An array of characters to exclude.
|
|
335
|
-
// * @param start_index The index to start searching backwards from.
|
|
336
|
-
// * @returns The index or null if none found.
|
|
337
|
-
// */
|
|
338
|
-
// last_index_not_of(exclude: string[], start_index?: number): number | null;
|
|
339
|
-
// /**
|
|
340
|
-
// * Inserts a substring at the specified index.
|
|
341
|
-
// * @param index The index to insert at.
|
|
342
|
-
// * @param substr The substring to insert.
|
|
343
|
-
// * @returns The new string.
|
|
344
|
-
// */
|
|
345
|
-
// insert(index: number, substr: string): string;
|
|
346
|
-
// /**
|
|
347
|
-
// * Removes a substring between the specified indices.
|
|
348
|
-
// * @param start The starting index.
|
|
349
|
-
// * @param end The ending index.
|
|
350
|
-
// * @returns The new string.
|
|
351
|
-
// */
|
|
352
|
-
// remove_indices(start: number, end: number): string;
|
|
353
|
-
// /**
|
|
354
|
-
// * Replaces a substring between the specified indices with another substring.
|
|
355
|
-
// * @param substr The substring to insert.
|
|
356
|
-
// * @param start The starting index.
|
|
357
|
-
// * @param end The ending index.
|
|
358
|
-
// * @returns The new string.
|
|
359
|
-
// */
|
|
360
|
-
// replace_indices(substr: string, start: number, end: number): string;
|
|
361
|
-
// /**
|
|
362
|
-
// * Checks if the string starts with a given substring at a specified index.
|
|
363
|
-
// * @param substr The substring to check.
|
|
364
|
-
// * @param start_index The index to start checking from.
|
|
365
|
-
// * @returns True if equal, false otherwise.
|
|
366
|
-
// */
|
|
367
|
-
// eq_first(substr: string, start_index?: number): boolean;
|
|
368
|
-
// /**
|
|
369
|
-
// * Checks if the string ends with a given substring.
|
|
370
|
-
// * @param substr The substring to check.
|
|
371
|
-
// * @returns True if equal, false otherwise.
|
|
372
|
-
// */
|
|
373
|
-
// eq_last(substr: string): boolean;
|
|
374
|
-
// /**
|
|
375
|
-
// * Ensures the string ends with one of the specified characters.
|
|
376
|
-
// * @param ensure_last A string of characters.
|
|
377
|
-
// * @returns The modified string.
|
|
378
|
-
// */
|
|
379
|
-
// ensure_last(ensure_last: string): string;
|
|
380
|
-
// /**
|
|
381
|
-
// * Checks if the string is uppercase.
|
|
382
|
-
// * @param allow_digits Whether to allow digits as uppercase.
|
|
383
|
-
// * @returns True if uppercase, false otherwise.
|
|
384
|
-
// */
|
|
385
|
-
// is_uppercase(allow_digits?: boolean): boolean;
|
|
386
|
-
// /**
|
|
387
|
-
// * Capitalizes the first letter of the string.
|
|
388
|
-
// * @returns The capitalized string.
|
|
389
|
-
// */
|
|
390
|
-
// capitalize_word(): string;
|
|
391
|
-
// /**
|
|
392
|
-
// * Capitalizes the first letter of each word in the string.
|
|
393
|
-
// * @returns The string with each word capitalized.
|
|
394
|
-
// */
|
|
395
|
-
// capitalize_words(): string;
|
|
396
|
-
// /**
|
|
397
|
-
// * Removes specified characters from the string.
|
|
398
|
-
// * @param char A character or array of characters to remove.
|
|
399
|
-
// * @returns The modified string.
|
|
400
|
-
// */
|
|
401
|
-
// drop(char: string | string[]): string;
|
|
402
|
-
// /**
|
|
403
|
-
// * Reverses the string.
|
|
404
|
-
// * @returns The reversed string.
|
|
405
|
-
// */
|
|
406
|
-
// reverse(): string;
|
|
407
|
-
// /**
|
|
408
|
-
// * Checks if the string represents an integer.
|
|
409
|
-
// * @returns True if it represents an integer, false otherwise.
|
|
410
|
-
// */
|
|
411
|
-
// is_integer_string(): boolean;
|
|
412
|
-
// /**
|
|
413
|
-
// * Checks if the string represents a floating-point number.
|
|
414
|
-
// * @returns True if it represents a float, false otherwise.
|
|
415
|
-
// */
|
|
416
|
-
// is_floating_string(): boolean;
|
|
417
|
-
// /**
|
|
418
|
-
// * Checks if the string is numeric.
|
|
419
|
-
// * @param info If true, returns an object with details.
|
|
420
|
-
// * @returns True if numeric, false otherwise, or an info object.
|
|
421
|
-
// */
|
|
422
|
-
// is_numeric_string(info?: boolean): boolean | { integer: boolean; floating: boolean };
|
|
423
|
-
// /**
|
|
424
|
-
// * Removes surrounding quotes from the string.
|
|
425
|
-
// * @returns The unquoted string.
|
|
426
|
-
// */
|
|
427
|
-
// unquote(): string;
|
|
428
|
-
// /**
|
|
429
|
-
// * Adds quotes around the string if not already quoted.
|
|
430
|
-
// * @returns The quoted string.
|
|
431
|
-
// */
|
|
432
|
-
// quote(): string;
|
|
433
|
-
// /**
|
|
434
|
-
// * Dedent a string.
|
|
435
|
-
// * @returns The dedented string.
|
|
436
|
-
// */
|
|
437
|
-
// dedent(): string;
|
|
438
|
-
// }
|
|
439
|
-
// // StringConstructor extensions
|
|
440
|
-
// interface StringConstructor {
|
|
441
|
-
// /**
|
|
442
|
-
// * Generates a random alphanumeric string.
|
|
443
|
-
// * @param length The length of the string. Default is 32.
|
|
444
|
-
// * @returns A random string.
|
|
445
|
-
// */
|
|
446
|
-
// random(length?: number): string;
|
|
447
|
-
// }
|
|
448
|
-
// }
|
|
449
|
-
// export {} // is required.
|
|
450
|
-
// // String prototype functions.
|
|
451
|
-
// String.prototype.first = function() {
|
|
452
|
-
// return this[0];
|
|
453
|
-
// };
|
|
454
|
-
// String.prototype.last = function() {
|
|
455
|
-
// return this[this.length - 1];
|
|
456
|
-
// };
|
|
457
|
-
// // Get the first non whitespace char, does not count \n as whitespace by default.
|
|
458
|
-
// String.prototype.first_non_whitespace = function(line_break = false) {
|
|
459
|
-
// for (let i = 0; i < this.length; i++) {
|
|
460
|
-
// const char = this.charAt(i);
|
|
461
|
-
// if (char != " " && char != "\t" && (line_break == false || char != "\n")) {
|
|
462
|
-
// return char;
|
|
463
|
-
// }
|
|
464
|
-
// }
|
|
465
|
-
// return null;
|
|
466
|
-
// };
|
|
467
|
-
// // Get the last non whitespace char, does not count \n as whitespace by default.
|
|
468
|
-
// String.prototype.last_non_whitespace = function(line_break = false) {
|
|
469
|
-
// for (let i = this.length - 1; i >= 0; i--) {
|
|
470
|
-
// const char = this.charAt(i);
|
|
471
|
-
// if (char != " " && char != "\t" && (line_break == false || char != "\n")) {
|
|
472
|
-
// return char;
|
|
473
|
-
// }
|
|
474
|
-
// }
|
|
475
|
-
// return null;
|
|
476
|
-
// };
|
|
477
|
-
// // Get the first non excluded character (index).
|
|
478
|
-
// String.prototype.first_not_of = function(exclude: string[] = [], start_index: number = 0) {
|
|
479
|
-
// for (let i: number = start_index; i < this.length; i++) {
|
|
480
|
-
// if (!exclude.includes(this.charAt(i))) {
|
|
481
|
-
// return this.charAt(i);
|
|
482
|
-
// }
|
|
483
|
-
// }
|
|
484
|
-
// return null;
|
|
485
|
-
// };
|
|
486
|
-
// String.prototype.first_index_not_of = function(exclude: string[] = [], start_index: number = 0) {
|
|
487
|
-
// for (let i: number = start_index; i < this.length; i++) {
|
|
488
|
-
// if (!exclude.includes(this.charAt(i))) {
|
|
489
|
-
// return i;
|
|
490
|
-
// }
|
|
491
|
-
// }
|
|
492
|
-
// return null;
|
|
493
|
-
// };
|
|
494
|
-
// // Get the last non excluded character (index).
|
|
495
|
-
// String.prototype.last_not_of = function(exclude: string[] = [], start_index: number = -1) {
|
|
496
|
-
// if (start_index === -1 || start_index == null) {
|
|
497
|
-
// start_index = this.length - 1;
|
|
498
|
-
// }
|
|
499
|
-
// for (let i = start_index as any as number; i >= 0; i--) {
|
|
500
|
-
// if (!exclude.includes(this.charAt(i))) {
|
|
501
|
-
// return this.charAt(i);
|
|
502
|
-
// }
|
|
503
|
-
// }
|
|
504
|
-
// return null;
|
|
505
|
-
// };
|
|
506
|
-
// String.prototype.last_index_not_of = function(exclude: string[] = [], start_index: number = -1) {
|
|
507
|
-
// if (start_index === -1 || start_index == null) {
|
|
508
|
-
// start_index = this.length - 1;
|
|
509
|
-
// }
|
|
510
|
-
// for (let i = start_index as any as number; i >= 0; i--) {
|
|
511
|
-
// if (!exclude.includes(this.charAt(i))) {
|
|
512
|
-
// return i;
|
|
513
|
-
// }
|
|
514
|
-
// }
|
|
515
|
-
// return null;
|
|
516
|
-
// };
|
|
517
|
-
// // Insert substr at index.
|
|
518
|
-
// String.prototype.insert = function(index, substr) {
|
|
519
|
-
// let edited = this.substr(0, index);
|
|
520
|
-
// edited += substr;
|
|
521
|
-
// edited += this.substr(index);
|
|
522
|
-
// return edited;
|
|
523
|
-
// };
|
|
524
|
-
// // Remove substr at index.
|
|
525
|
-
// String.prototype.remove_indices = function(start, end) {
|
|
526
|
-
// let edited = this.substr(0, start);
|
|
527
|
-
// edited += this.substr(end);
|
|
528
|
-
// return edited;
|
|
529
|
-
// };
|
|
530
|
-
// // Remove substr at index.
|
|
531
|
-
// String.prototype.replace_indices = function(substr, start, end) {
|
|
532
|
-
// let edited = this.substr(0, start);
|
|
533
|
-
// edited += substr;
|
|
534
|
-
// edited += this.substr(end);
|
|
535
|
-
// return edited;
|
|
536
|
-
// };
|
|
537
|
-
// // Check if the first chars of the main string equals a substring, optionally with start index.
|
|
538
|
-
// String.prototype.eq_first = function(substr, start_index = 0) {
|
|
539
|
-
// if (start_index + substr.length > this.length) {
|
|
540
|
-
// return false;
|
|
541
|
-
// }
|
|
542
|
-
// const end = start_index + substr.length;
|
|
543
|
-
// let y = 0;
|
|
544
|
-
// for (let x = start_index; x < end; x++) {
|
|
545
|
-
// if (this.charAt(x) != substr.charAt(y)) {
|
|
546
|
-
// return false;
|
|
547
|
-
// }
|
|
548
|
-
// ++y;
|
|
549
|
-
// }
|
|
550
|
-
// return true;
|
|
551
|
-
// }
|
|
552
|
-
// // Check if the last chars of the main string equals a substring.
|
|
553
|
-
// String.prototype.eq_last = function(substr) {
|
|
554
|
-
// if (substr.length > this.length) {
|
|
555
|
-
// return false;
|
|
556
|
-
// }
|
|
557
|
-
// let y = 0;
|
|
558
|
-
// for (let x = this.length - substr.length; x < this.length; x++) {
|
|
559
|
-
// if (this.charAt(x) != substr.charAt(y)) {
|
|
560
|
-
// return false;
|
|
561
|
-
// }
|
|
562
|
-
// ++y;
|
|
563
|
-
// }
|
|
564
|
-
// return true;
|
|
565
|
-
// }
|
|
566
|
-
// // Ensure last, checks if one of the characters of the `ensure_last` parameter is the last character, if not then it adds the first character of the `ensure_last` parameter to the end of the string.
|
|
567
|
-
// // The newly created string will be returned.
|
|
568
|
-
// String.prototype.ensure_last = function(ensure_last) {
|
|
569
|
-
// if (ensure_last.indexOf(this.charAt(this.length - 1)) === -1) {
|
|
570
|
-
// return this + ensure_last.charAt(0);
|
|
571
|
-
// }
|
|
572
|
-
// if (this instanceof String) {
|
|
573
|
-
// return this.toString()
|
|
574
|
-
// }
|
|
575
|
-
// return this;
|
|
576
|
-
// }
|
|
577
|
-
// // Check if a word is uppercase only.
|
|
578
|
-
// String.prototype.is_uppercase = function(allow_digits = false) {
|
|
579
|
-
// let uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
580
|
-
// if (allow_digits) {
|
|
581
|
-
// uppercase += "0123456789";
|
|
582
|
-
// }
|
|
583
|
-
// for (let i = 0; i < this.length; i++) {
|
|
584
|
-
// if (uppercase.indexOf(this.charAt(i)) === -1) {
|
|
585
|
-
// return false;
|
|
586
|
-
// }
|
|
587
|
-
// }
|
|
588
|
-
// return true;
|
|
589
|
-
// }
|
|
590
|
-
// // Capitalize as a word (only the first letter).
|
|
591
|
-
// String.prototype.capitalize_word = function() {
|
|
592
|
-
// if ("abcdefghijklmopqrstuvwxyz".includes(this.charAt(0))) {
|
|
593
|
-
// return this.charAt(0).toUpperCase() + this.substr(1);
|
|
594
|
-
// }
|
|
595
|
-
// if (this instanceof String) {
|
|
596
|
-
// return this.toString()
|
|
597
|
-
// }
|
|
598
|
-
// return this;
|
|
599
|
-
// }
|
|
600
|
-
// // Capitalize the first letter of each word seperated by whitespace in a string.
|
|
601
|
-
// String.prototype.capitalize_words = function() {
|
|
602
|
-
// let batch = "";
|
|
603
|
-
// let capitalized = "";
|
|
604
|
-
// for (let i = 0; i < this.length; i++) {
|
|
605
|
-
// const c = this.charAt(i);
|
|
606
|
-
// if (c === " " || c === "\t" || c === "\n") {
|
|
607
|
-
// capitalized += batch.capitalize_word();
|
|
608
|
-
// batch = "";
|
|
609
|
-
// capitalized += c;
|
|
610
|
-
// } else {
|
|
611
|
-
// batch += c;
|
|
612
|
-
// }
|
|
613
|
-
// }
|
|
614
|
-
// capitalized += batch.capitalize_word();
|
|
615
|
-
// return capitalized;
|
|
616
|
-
// }
|
|
617
|
-
// // Drop a single char or an array of characters.
|
|
618
|
-
// String.prototype.drop = function(char) {
|
|
619
|
-
// const is_array = Array.isArray(char);
|
|
620
|
-
// let dropped = "";
|
|
621
|
-
// for (let i = 0; i < this.length; i++) {
|
|
622
|
-
// const c = this.charAt(i);
|
|
623
|
-
// if (is_array) {
|
|
624
|
-
// if (char.includes(c) === false) {
|
|
625
|
-
// dropped += c;
|
|
626
|
-
// }
|
|
627
|
-
// } else {
|
|
628
|
-
// if (char !== c) {
|
|
629
|
-
// dropped += c;
|
|
630
|
-
// }
|
|
631
|
-
// }
|
|
632
|
-
// }
|
|
633
|
-
// return dropped;
|
|
634
|
-
// }
|
|
635
|
-
// // Reverse the string.
|
|
636
|
-
// String.prototype.reverse = function() {
|
|
637
|
-
// let reversed = "";
|
|
638
|
-
// for (let i = this.length - 1; i >= 0; i--) {
|
|
639
|
-
// reversed += this.charAt(i);
|
|
640
|
-
// }
|
|
641
|
-
// return reversed;
|
|
642
|
-
// }
|
|
643
|
-
// // Generate a random string.
|
|
644
|
-
// String.random = function(length = 32) {
|
|
645
|
-
// const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
646
|
-
// let result = "";
|
|
647
|
-
// for (let i = 0; i < length; i++) {
|
|
648
|
-
// result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
649
|
-
// }
|
|
650
|
-
// return result;
|
|
651
|
-
// }
|
|
652
|
-
// // Check if a string is a integer in string format
|
|
653
|
-
// String.prototype.is_integer_string = function() {
|
|
654
|
-
// const chars = '0123456789';
|
|
655
|
-
// for (let i = 0; i < this.length; i++) {
|
|
656
|
-
// if (chars.indexOf(this.charAt(i)) === -1) {
|
|
657
|
-
// return false;
|
|
658
|
-
// }
|
|
659
|
-
// }
|
|
660
|
-
// return true;
|
|
661
|
-
// }
|
|
662
|
-
// // Check if a string is a floating in string format
|
|
663
|
-
// String.prototype.is_floating_string = function() {
|
|
664
|
-
// const chars = '0123456789';
|
|
665
|
-
// let decimal = false;
|
|
666
|
-
// for (let i = 0; i < this.length; i++) {
|
|
667
|
-
// const char = this.charAt(i);
|
|
668
|
-
// if (char === '.') {
|
|
669
|
-
// if (decimal) { return false; }
|
|
670
|
-
// decimal = true;
|
|
671
|
-
// } else if (chars.indexOf(char) === -1) {
|
|
672
|
-
// return false;
|
|
673
|
-
// }
|
|
674
|
-
// }
|
|
675
|
-
// return decimal;
|
|
676
|
-
// }
|
|
677
|
-
// // Check if a string is a numeric in string format
|
|
678
|
-
// String.prototype.is_numeric_string = function(info = false) {
|
|
679
|
-
// const chars = '0123456789';
|
|
680
|
-
// let decimal = false;
|
|
681
|
-
// for (let i = 0; i < this.length; i++) {
|
|
682
|
-
// const char = this.charAt(i);
|
|
683
|
-
// if (char === '.') {
|
|
684
|
-
// if (decimal) { return false; }
|
|
685
|
-
// decimal = true;
|
|
686
|
-
// } else if (chars.indexOf(char) === -1) {
|
|
687
|
-
// if (info) {
|
|
688
|
-
// return {integer: false, floating: false};
|
|
689
|
-
// }
|
|
690
|
-
// return false;
|
|
691
|
-
// }
|
|
692
|
-
// }
|
|
693
|
-
// if (info) {
|
|
694
|
-
// return {integer: decimal === false, floating: decimal === true};
|
|
695
|
-
// }
|
|
696
|
-
// return true;
|
|
697
|
-
// }
|
|
698
|
-
// // Unquote a string.
|
|
699
|
-
// String.prototype.unquote = function() {
|
|
700
|
-
// if ((this.startsWith('"') && this.endsWith('"')) || (this.startsWith("'") && this.endsWith("'"))) {
|
|
701
|
-
// return this.slice(1, -1);
|
|
702
|
-
// }
|
|
703
|
-
// if (this instanceof String) {
|
|
704
|
-
// return this.toString()
|
|
705
|
-
// }
|
|
706
|
-
// return this;
|
|
707
|
-
// }
|
|
708
|
-
// // Quote a string.
|
|
709
|
-
// String.prototype.quote = function() {
|
|
710
|
-
// if ((this.startsWith('"') && this.endsWith('"')) || (this.startsWith("'") && this.endsWith("'"))) {
|
|
711
|
-
// if (this instanceof String) {
|
|
712
|
-
// return this.toString()
|
|
713
|
-
// }
|
|
714
|
-
// return this;
|
|
715
|
-
// }
|
|
716
|
-
// return `"${this}"`;
|
|
717
|
-
// }
|
|
718
|
-
// // Then implement the function
|
|
719
|
-
// /**
|
|
720
|
-
// * @deprecated
|
|
721
|
-
// */
|
|
722
|
-
// String.prototype.dedent = function(allow_empty_first_line = false) {
|
|
723
|
-
// // Allow empty first line.
|
|
724
|
-
// let data = this;
|
|
725
|
-
// if (allow_empty_first_line) {
|
|
726
|
-
// const line_break = data.indexOf("\n");
|
|
727
|
-
// if (line_break !== -1) {
|
|
728
|
-
// data = data.slice(line_break + 1).dedent();
|
|
729
|
-
// } else {
|
|
730
|
-
// data = data.trimStart();
|
|
731
|
-
// }
|
|
732
|
-
// }
|
|
733
|
-
// // Split the string into lines.
|
|
734
|
-
// const lines = data.split('\n');
|
|
735
|
-
// // Find minimum indentation.
|
|
736
|
-
// const indent = lines
|
|
737
|
-
// .filter(line => line.trim())
|
|
738
|
-
// .map(line => line.match(/^[ \t]*/)?.[0].length ?? Infinity)
|
|
739
|
-
// .reduce((min, curr) => Math.min(min, curr), Infinity);
|
|
740
|
-
// // Remove common indentation.
|
|
741
|
-
// return lines
|
|
742
|
-
// .map(line => line.slice(indent))
|
|
743
|
-
// .join('\n')
|
|
744
|
-
// .trim();
|
|
745
|
-
// };
|