vviinn-widgets 2.7.2 → 2.8.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/dist/components/Handler.js +270 -0
- package/dist/components/NonEmptyArray.js +5699 -0
- package/dist/components/cropper-handler.js +6 -0
- package/dist/components/cropper-handler2.js +39 -0
- package/dist/{cjs/customized-slots-06ca4007.js → components/customized-slots.js} +3 -6
- package/dist/components/highlight-box.js +6 -0
- package/dist/components/highlight-box2.js +52 -0
- package/dist/components/image-cropper.js +6 -0
- package/dist/components/image-cropper2.js +138 -0
- package/dist/components/imageSearch.store.js +10686 -0
- package/dist/components/index.js +1 -0
- package/dist/{esm/index-443468c7.js → components/index2.js} +2 -2
- package/dist/components/index3.js +130 -0
- package/dist/components/recommendations-sidebar.js +101 -0
- package/dist/components/resizer.worker.js +11 -0
- package/dist/components/search-filters.js +6 -0
- package/dist/components/search-filters2.js +89 -0
- package/dist/components/tracking.worker.js +11 -0
- package/dist/components/vviinn-carousel.js +6 -0
- package/dist/components/vviinn-carousel2.js +235 -0
- package/dist/components/vviinn-detected-object.js +6 -0
- package/dist/components/vviinn-detected-object2.js +67 -0
- package/dist/components/vviinn-empty-results.js +6 -0
- package/dist/components/vviinn-empty-results2.js +35 -0
- package/dist/components/vviinn-error.js +6 -0
- package/dist/components/vviinn-error2.js +28 -0
- package/dist/components/vviinn-example-image.js +6 -0
- package/dist/components/vviinn-example-image2.js +57 -0
- package/dist/components/vviinn-example-images.js +6 -0
- package/dist/components/vviinn-example-images2.js +53 -0
- package/dist/components/vviinn-image-selector.js +6 -0
- package/dist/components/vviinn-image-selector2.js +135 -0
- package/dist/components/vviinn-image-view.js +6 -0
- package/dist/components/vviinn-image-view2.js +95 -0
- package/dist/components/vviinn-modal.js +6 -0
- package/dist/components/vviinn-modal2.js +46 -0
- package/dist/components/vviinn-onboarding-card-1.js +6 -0
- package/dist/components/vviinn-onboarding-card-12.js +34 -0
- package/dist/components/vviinn-onboarding-card-2.js +6 -0
- package/dist/components/vviinn-onboarding-card-22.js +34 -0
- package/dist/components/vviinn-onboarding-card-3.js +6 -0
- package/dist/components/vviinn-onboarding-card-32.js +34 -0
- package/dist/components/vviinn-onboarding.js +6 -0
- package/dist/components/vviinn-onboarding2.js +63 -0
- package/dist/components/vviinn-overlay.js +6 -0
- package/dist/components/vviinn-overlay2.js +28 -0
- package/dist/components/vviinn-overlayed-modal.js +6 -0
- package/dist/components/vviinn-overlayed-modal2.js +45 -0
- package/dist/components/vviinn-preloader.js +6 -0
- package/dist/components/vviinn-preloader2.js +34 -0
- package/dist/components/vviinn-privacy-badge.js +6 -0
- package/dist/components/vviinn-privacy-badge2.js +33 -0
- package/dist/components/vviinn-product-card.js +6 -0
- package/dist/components/vviinn-product-card2.js +216 -0
- package/dist/components/vviinn-recommendations-sidebar.js +6 -0
- package/dist/components/vviinn-server-error.js +6 -0
- package/dist/components/vviinn-server-error2.js +35 -0
- package/dist/components/vviinn-slide.js +6 -0
- package/dist/components/vviinn-slide2.js +28 -0
- package/dist/components/vviinn-slider.js +6 -0
- package/dist/components/vviinn-slider2.js +159 -0
- package/dist/components/vviinn-teaser.js +6 -0
- package/dist/components/vviinn-teaser2.js +33 -0
- package/dist/components/vviinn-vpr-button.js +93 -0
- package/dist/components/vviinn-vpr-vidget.js +3360 -0
- package/dist/components/vviinn-vpr-widget.js +6 -0
- package/dist/components/vviinn-vps-button.js +224 -0
- package/dist/components/vviinn-vps-widget.js +6 -0
- package/dist/components/vviinn-vps-widget2.js +350 -0
- package/dist/components/vviinn-wrong-format.js +6 -0
- package/dist/components/vviinn-wrong-format2.js +35 -0
- package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +1 -0
- package/dist/types/components/vviinn-vpr-button/stories/lol.d.ts +2 -0
- package/dist/types/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.d.ts +1 -1
- package/dist/vviinn-widgets/Array-bdfc75db.js +4870 -0
- package/dist/vviinn-widgets/Handler-edcb46f4.js +1422 -0
- package/dist/vviinn-widgets/NonEmptyArray-947ab7b3.js +4411 -0
- package/dist/{esm/app-globals-865bc7a7.js → vviinn-widgets/app-globals-c0aa8ec3.js} +922 -10
- package/dist/vviinn-widgets/cropper-handler.entry.js +23 -0
- package/dist/vviinn-widgets/css-shim-f0027935.js +4 -0
- package/dist/{esm/customized-slots-96902edf.js → vviinn-widgets/customized-slots-5c1c623a.js} +1 -1
- package/dist/vviinn-widgets/dom-db0073f0.js +73 -0
- package/dist/vviinn-widgets/highlight-box.entry.js +41 -0
- package/dist/{collection/components/image-search/image-view/image-cropper/image-cropper.js → vviinn-widgets/image-cropper.entry.js} +33 -70
- package/dist/{cjs/index-df6896e2.js → vviinn-widgets/imageSearch.store-0eed9a5c.js} +11598 -15320
- package/dist/{esm/index-2fdd499d.js → vviinn-widgets/imageSearch.store-b28bddb0.js} +11971 -15281
- package/dist/{collection/components/vviinn-icons/index.js → vviinn-widgets/index-44058ea2.js} +14 -11
- package/dist/vviinn-widgets/index-6c6de682.js +3857 -0
- package/dist/vviinn-widgets/index-de3e14da.js +3010 -0
- package/dist/vviinn-widgets/index.esm.js +1 -0
- package/dist/vviinn-widgets/number-171db649.js +1499 -0
- package/dist/vviinn-widgets/search-filters.entry.js +76 -0
- package/dist/vviinn-widgets/shadow-css-c1fdfa9f.js +389 -0
- package/dist/{collection/components/vviinn-carousel/vviinn-carousel.js → vviinn-widgets/vviinn-carousel.entry.js} +18 -113
- package/dist/vviinn-widgets/vviinn-detected-object.entry.js +54 -0
- package/dist/vviinn-widgets/vviinn-empty-results.entry.js +16 -0
- package/dist/vviinn-widgets/vviinn-error.entry.js +15 -0
- package/dist/vviinn-widgets/vviinn-example-image.entry.js +38 -0
- package/dist/vviinn-widgets/vviinn-example-images.entry.js +28 -0
- package/dist/vviinn-widgets/vviinn-image-selector.entry.js +31 -0
- package/dist/vviinn-widgets/vviinn-image-view.entry.js +55 -0
- package/dist/vviinn-widgets/vviinn-modal.entry.js +30 -0
- package/dist/vviinn-widgets/vviinn-onboarding-card-1.entry.js +21 -0
- package/dist/vviinn-widgets/vviinn-onboarding-card-2.entry.js +21 -0
- package/dist/vviinn-widgets/vviinn-onboarding-card-3.entry.js +21 -0
- package/dist/vviinn-widgets/vviinn-onboarding.entry.js +20 -0
- package/dist/vviinn-widgets/vviinn-overlay.entry.js +15 -0
- package/dist/vviinn-widgets/vviinn-overlayed-modal.entry.js +18 -0
- package/dist/vviinn-widgets/vviinn-preloader.entry.js +25 -0
- package/dist/vviinn-widgets/vviinn-privacy-badge.entry.js +20 -0
- package/dist/vviinn-widgets/vviinn-product-card.entry.js +188 -0
- package/dist/{esm → vviinn-widgets}/vviinn-recommendations-sidebar.entry.js +2 -2
- package/dist/vviinn-widgets/vviinn-server-error.entry.js +16 -0
- package/dist/vviinn-widgets/vviinn-slide.entry.js +15 -0
- package/dist/vviinn-widgets/vviinn-slider.entry.js +120 -0
- package/dist/vviinn-widgets/vviinn-teaser.entry.js +20 -0
- package/dist/{esm → vviinn-widgets}/vviinn-vpr-button.entry.js +2 -2
- package/dist/vviinn-widgets/vviinn-vpr-widget.entry.js +4588 -0
- package/dist/{esm → vviinn-widgets}/vviinn-vps-button.entry.js +3 -3
- package/dist/vviinn-widgets/vviinn-vps-widget.entry.js +170 -0
- package/dist/vviinn-widgets/vviinn-widgets.css +6 -1
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +125 -1
- package/dist/vviinn-widgets/vviinn-wrong-format.entry.js +16 -0
- package/package.json +8 -2
- package/www/build/p-06c76b5e.js +1 -0
- package/www/build/p-07e16d04.js +15 -0
- package/{dist/vviinn-widgets/p-a6e0710f.entry.js → www/build/p-44bc50de.entry.js} +1 -1
- package/www/build/p-510922c6.js +1 -0
- package/www/build/p-57ce8de3.css +1 -0
- package/www/build/p-591cb193.entry.js +1 -0
- package/www/build/p-6b9d242e.js +1 -0
- package/www/build/p-880bccf1.js +1 -0
- package/www/build/p-b0ada114.entry.js +1 -0
- package/www/build/p-b7be7c70.entry.js +1 -0
- package/{dist/vviinn-widgets/p-166970f3.js → www/build/p-ea8dea5c.js} +1 -1
- package/www/build/vviinn-widgets.css +1 -1
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +32261 -1
- package/www/sw.js +66 -0
- package/dist/cjs/app-globals-8db3bcbe.js +0 -6912
- package/dist/cjs/cropper-handler_27.cjs.entry.js +0 -1135
- package/dist/cjs/index-3c3ab815.js +0 -1354
- package/dist/cjs/index-f66cd8d1.js +0 -39
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -23
- package/dist/cjs/vviinn-carousel_2.cjs.entry.js +0 -1001
- package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +0 -65
- package/dist/cjs/vviinn-vpr-button.cjs.entry.js +0 -49
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +0 -43
- package/dist/cjs/vviinn-widgets.cjs.js +0 -21
- package/dist/collection/Image/error.js +0 -14
- package/dist/collection/Image/form.js +0 -5
- package/dist/collection/Image/fromFile.js +0 -18
- package/dist/collection/Image/imageToB64.js +0 -9
- package/dist/collection/Image/index.js +0 -0
- package/dist/collection/Image/renderPromise.js +0 -6
- package/dist/collection/Image/resizeImage.js +0 -28
- package/dist/collection/Image/sizing.js +0 -39
- package/dist/collection/Image/toFile.js +0 -17
- package/dist/collection/analytics/GAnalytics.js +0 -32
- package/dist/collection/analytics/GeneralAnalytics.js +0 -9
- package/dist/collection/analytics/GtagAnalytics.js +0 -35
- package/dist/collection/analytics/ProductAnalytics.js +0 -1
- package/dist/collection/campaign/Campaign.js +0 -8
- package/dist/collection/campaign/CampaignService.js +0 -5
- package/dist/collection/campaign/VCSCampaign.js +0 -1
- package/dist/collection/campaign/VCSCampaignResponse.js +0 -1
- package/dist/collection/campaign/VCSCampaignService.js +0 -7
- package/dist/collection/campaign/VPRCampaignResponse.js +0 -1
- package/dist/collection/campaign/VPRCampaignService.js +0 -7
- package/dist/collection/collection-manifest.json +0 -43
- package/dist/collection/components/customized-slots.js +0 -47
- package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.css +0 -71
- package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.js +0 -25
- package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.css +0 -49
- package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.js +0 -64
- package/dist/collection/components/image-search/image-view/image-cropper/image-cropper.css +0 -33
- package/dist/collection/components/image-search/search-filters/search-filters.css +0 -120
- package/dist/collection/components/image-search/search-filters/search-filters.js +0 -125
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +0 -142
- package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.css +0 -7
- package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.js +0 -36
- package/dist/collection/components/vviinn-error/vviinn-error.css +0 -38
- package/dist/collection/components/vviinn-error/vviinn-error.js +0 -18
- package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.css +0 -3
- package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.js +0 -34
- package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.css +0 -3
- package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.js +0 -34
- package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.css +0 -34
- package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.js +0 -129
- package/dist/collection/components/vviinn-example-images/vviinn-example-images.css +0 -19
- package/dist/collection/components/vviinn-example-images/vviinn-example-images.js +0 -80
- package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.css +0 -25
- package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.js +0 -64
- package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.css +0 -47
- package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.js +0 -100
- package/dist/collection/components/vviinn-image-view/vviinn-image-view.css +0 -31
- package/dist/collection/components/vviinn-image-view/vviinn-image-view.js +0 -61
- package/dist/collection/components/vviinn-modal/vviinn-modal.css +0 -105
- package/dist/collection/components/vviinn-modal/vviinn-modal.js +0 -98
- package/dist/collection/components/vviinn-onboarding/onboarding-cards/onboarding-card.css +0 -41
- package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-1/vviinn-onboarding-card-1.js +0 -26
- package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-2/vviinn-onboarding-card-2.js +0 -26
- package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-3/vviinn-onboarding-card-3.js +0 -26
- package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.css +0 -58
- package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.js +0 -28
- package/dist/collection/components/vviinn-overlay/vviinn-overlay.css +0 -33
- package/dist/collection/components/vviinn-overlay/vviinn-overlay.js +0 -15
- package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.css +0 -29
- package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.js +0 -71
- package/dist/collection/components/vviinn-preloader/vviinn-preloader.css +0 -37
- package/dist/collection/components/vviinn-preloader/vviinn-preloader.js +0 -20
- package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.css +0 -19
- package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.js +0 -27
- package/dist/collection/components/vviinn-product-card/render-helpers.js +0 -32
- package/dist/collection/components/vviinn-product-card/stories/args.js +0 -73
- package/dist/collection/components/vviinn-product-card/stories/decorators.js +0 -51
- package/dist/collection/components/vviinn-product-card/stories/vviinn-product-card.stories.js +0 -105
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.css +0 -95
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +0 -462
- package/dist/collection/components/vviinn-slider/arrow.js +0 -11
- package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.css +0 -4
- package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.js +0 -15
- package/dist/collection/components/vviinn-slider/vviinn-slider.css +0 -109
- package/dist/collection/components/vviinn-slider/vviinn-slider.js +0 -181
- package/dist/collection/components/vviinn-teaser/vviinn-teaser.css +0 -14
- package/dist/collection/components/vviinn-teaser/vviinn-teaser.js +0 -29
- package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.css +0 -238
- package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +0 -220
- package/dist/collection/components/vviinn-vpr-button/stories/args.js +0 -213
- package/dist/collection/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.js +0 -91
- package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +0 -35
- package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +0 -179
- package/dist/collection/components/vviinn-vpr-widget/stories/args.js +0 -197
- package/dist/collection/components/vviinn-vpr-widget/stories/decorators.js +0 -29
- package/dist/collection/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.js +0 -211
- package/dist/collection/components/vviinn-vpr-widget/token-helpers.js +0 -11
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +0 -510
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +0 -79
- package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +0 -35
- package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.css +0 -3
- package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +0 -195
- package/dist/collection/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.js +0 -37
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.css +0 -350
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +0 -375
- package/dist/collection/cropper/Cropper.js +0 -1
- package/dist/collection/cropper/Handler.js +0 -61
- package/dist/collection/dom/index.js +0 -3
- package/dist/collection/error.js +0 -14
- package/dist/collection/file/index.js +0 -4
- package/dist/collection/geometry/Clip.js +0 -14
- package/dist/collection/geometry/Point.js +0 -32
- package/dist/collection/geometry/Rectangle.js +0 -95
- package/dist/collection/geometry/RectangleAlt.js +0 -1
- package/dist/collection/geometry/Sized.js +0 -8
- package/dist/collection/global.js +0 -19
- package/dist/collection/index.js +0 -1
- package/dist/collection/interfaces/generated.js +0 -5
- package/dist/collection/interfaces/recommendation.js +0 -1
- package/dist/collection/network/apiClient.js +0 -9
- package/dist/collection/network/ion/File.js +0 -14
- package/dist/collection/network/ion/Form.js +0 -64
- package/dist/collection/network/ion/Link.js +0 -8
- package/dist/collection/network/ion/ValueObject.js +0 -23
- package/dist/collection/network/request.js +0 -19
- package/dist/collection/network/utils.js +0 -37
- package/dist/collection/openApi/index.js +0 -27
- package/dist/collection/recommendation/events.js +0 -1
- package/dist/collection/recommendation/recommendation.js +0 -1
- package/dist/collection/searchSession/searchSession.js +0 -31
- package/dist/collection/sentry.js +0 -14
- package/dist/collection/slider/GridMode.js +0 -1
- package/dist/collection/store/file-processing.js +0 -13
- package/dist/collection/store/imageSearch.store.js +0 -133
- package/dist/collection/store/store.js +0 -3
- package/dist/collection/store/tracking.store.js +0 -3
- package/dist/collection/stories/Button.js +0 -21
- package/dist/collection/stories/Button.stories.js +0 -42
- package/dist/collection/stories/Header.js +0 -45
- package/dist/collection/stories/Header.stories.js +0 -15
- package/dist/collection/stories/Page.js +0 -61
- package/dist/collection/stories/Page.stories.js +0 -19
- package/dist/collection/stories/assets/code-brackets.svg +0 -1
- package/dist/collection/stories/assets/colors.svg +0 -1
- package/dist/collection/stories/assets/comments.svg +0 -1
- package/dist/collection/stories/assets/direction.svg +0 -1
- package/dist/collection/stories/assets/flow.svg +0 -1
- package/dist/collection/stories/assets/plugin.svg +0 -1
- package/dist/collection/stories/assets/repo.svg +0 -1
- package/dist/collection/stories/assets/stackalt.svg +0 -1
- package/dist/collection/stories/image-selector.stories.js +0 -6
- package/dist/collection/stories/image-view.stories.js +0 -6
- package/dist/collection/stories/modal.stories.js +0 -12
- package/dist/collection/stories/onboarding.stories.js +0 -11
- package/dist/collection/stories/overlay.stories.js +0 -5
- package/dist/collection/stories/overlayedModal.stories.js +0 -8
- package/dist/collection/stories/privacy-badge.stories.js +0 -11
- package/dist/collection/stories/slider.stories.js +0 -17
- package/dist/collection/stories/teaser.stories.js +0 -5
- package/dist/collection/stories/vps-widget.stories.js +0 -47
- package/dist/collection/stories/vviinn-product.stories.js +0 -19
- package/dist/collection/tracking/event.js +0 -3
- package/dist/collection/tracking/filter.js +0 -5
- package/dist/collection/tracking/index.js +0 -13
- package/dist/collection/tracking/models.js +0 -6
- package/dist/collection/tracking/product.js +0 -18
- package/dist/collection/tracking/search.js +0 -5
- package/dist/collection/tracking/widget.js +0 -10
- package/dist/collection/utils/collections/collectionsUtils.js +0 -5
- package/dist/collection/utils/either.js +0 -3
- package/dist/collection/utils/enum/enumUtils.js +0 -3
- package/dist/collection/utils/event/Events.js +0 -1
- package/dist/collection/utils/number/index.js +0 -4
- package/dist/collection/utils/option/option.js +0 -4
- package/dist/collection/utils/semigroup/semigroupDiff.js +0 -6
- package/dist/collection/utils/token/tokenUtils.js +0 -9
- package/dist/esm/cropper-handler_27.entry.js +0 -1105
- package/dist/esm/index-51f71d18.js +0 -1323
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -19
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/vviinn-carousel_2.entry.js +0 -996
- package/dist/esm/vviinn-widgets.js +0 -19
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/loader/cdn.js +0 -3
- package/dist/loader/index.cjs.js +0 -3
- package/dist/loader/index.d.ts +0 -12
- package/dist/loader/index.es2017.js +0 -3
- package/dist/loader/index.js +0 -4
- package/dist/loader/package.json +0 -10
- package/dist/vviinn-widgets/p-2dd35f19.entry.js +0 -1
- package/dist/vviinn-widgets/p-3469b71a.js +0 -1
- package/dist/vviinn-widgets/p-40bea5b5.entry.js +0 -1
- package/dist/vviinn-widgets/p-465d043d.js +0 -15
- package/dist/vviinn-widgets/p-59bd2a99.js +0 -1
- package/dist/vviinn-widgets/p-74ed36af.entry.js +0 -1
- package/dist/vviinn-widgets/p-9def6b8b.entry.js +0 -1
- package/dist/vviinn-widgets/p-cd995515.js +0 -1
- package/www/build/p-166970f3.js +0 -1
- package/www/build/p-2dd35f19.entry.js +0 -1
- package/www/build/p-3469b71a.js +0 -1
- package/www/build/p-40bea5b5.entry.js +0 -1
- package/www/build/p-465d043d.js +0 -15
- package/www/build/p-59bd2a99.js +0 -1
- package/www/build/p-61933b75.js +0 -1
- package/www/build/p-74ed36af.entry.js +0 -1
- package/www/build/p-9def6b8b.entry.js +0 -1
- package/www/build/p-a67898be.css +0 -1
- package/www/build/p-a6e0710f.entry.js +0 -1
- package/www/build/p-cd995515.js +0 -1
- package/www/favicon.ico +0 -0
|
@@ -0,0 +1,1499 @@
|
|
|
1
|
+
import { c as createCommonjsModule, A as Apply, F as Functor, _ as _function, g as getDefaultExportFromCjs, a as commonjsGlobal, i as internal, Z as Zero, S as Separated, W as Witherable, C as Chain, b as FromEither, d as Semigroup } from './NonEmptyArray-947ab7b3.js';
|
|
2
|
+
|
|
3
|
+
var Applicative = createCommonjsModule(function (module, exports) {
|
|
4
|
+
"use strict";
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getApplicativeComposition = exports.getApplicativeMonoid = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* The `Applicative` type class extends the `Apply` type class with a `of` function, which can be used to create values
|
|
9
|
+
* of type `f a` from values of type `a`.
|
|
10
|
+
*
|
|
11
|
+
* Where `Apply` provides the ability to lift functions of two or more arguments to functions whose arguments are
|
|
12
|
+
* wrapped using `f`, and `Functor` provides the ability to lift functions of one argument, `pure` can be seen as the
|
|
13
|
+
* function which lifts functions of _zero_ arguments. That is, `Applicative` functors support a lifting operation for
|
|
14
|
+
* any number of function arguments.
|
|
15
|
+
*
|
|
16
|
+
* Instances must satisfy the following laws in addition to the `Apply` laws:
|
|
17
|
+
*
|
|
18
|
+
* 1. Identity: `A.ap(A.of(a => a), fa) <-> fa`
|
|
19
|
+
* 2. Homomorphism: `A.ap(A.of(ab), A.of(a)) <-> A.of(ab(a))`
|
|
20
|
+
* 3. Interchange: `A.ap(fab, A.of(a)) <-> A.ap(A.of(ab => ab(a)), fab)`
|
|
21
|
+
*
|
|
22
|
+
* Note. `Functor`'s `map` can be derived: `A.map(x, f) = A.ap(A.of(f), x)`
|
|
23
|
+
*
|
|
24
|
+
* @since 2.0.0
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
function getApplicativeMonoid(F) {
|
|
30
|
+
var f = (0, Apply.getApplySemigroup)(F);
|
|
31
|
+
return function (M) { return ({
|
|
32
|
+
concat: f(M).concat,
|
|
33
|
+
empty: F.of(M.empty)
|
|
34
|
+
}); };
|
|
35
|
+
}
|
|
36
|
+
exports.getApplicativeMonoid = getApplicativeMonoid;
|
|
37
|
+
/** @deprecated */
|
|
38
|
+
function getApplicativeComposition(F, G) {
|
|
39
|
+
var map = (0, Functor.getFunctorComposition)(F, G).map;
|
|
40
|
+
var _ap = (0, Apply.ap)(F, G);
|
|
41
|
+
return {
|
|
42
|
+
map: map,
|
|
43
|
+
of: function (a) { return F.of(G.of(a)); },
|
|
44
|
+
ap: function (fgab, fga) { return (0, _function.pipe)(fgab, _ap(fga)); }
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.getApplicativeComposition = getApplicativeComposition;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const Applicative$1 = /*@__PURE__*/getDefaultExportFromCjs(Applicative);
|
|
51
|
+
|
|
52
|
+
var Predicate = createCommonjsModule(function (module, exports) {
|
|
53
|
+
"use strict";
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.and = exports.or = exports.not = exports.Contravariant = exports.getMonoidAll = exports.getSemigroupAll = exports.getMonoidAny = exports.getSemigroupAny = exports.URI = exports.contramap = void 0;
|
|
56
|
+
|
|
57
|
+
// -------------------------------------------------------------------------------------
|
|
58
|
+
// type class members
|
|
59
|
+
// -------------------------------------------------------------------------------------
|
|
60
|
+
var contramap_ = function (predicate, f) { return (0, _function.pipe)(predicate, (0, exports.contramap)(f)); };
|
|
61
|
+
/**
|
|
62
|
+
* @category Contravariant
|
|
63
|
+
* @since 2.11.0
|
|
64
|
+
*/
|
|
65
|
+
var contramap = function (f) { return function (predicate) { return (0, _function.flow)(f, predicate); }; };
|
|
66
|
+
exports.contramap = contramap;
|
|
67
|
+
// -------------------------------------------------------------------------------------
|
|
68
|
+
// instances
|
|
69
|
+
// -------------------------------------------------------------------------------------
|
|
70
|
+
/**
|
|
71
|
+
* @category instances
|
|
72
|
+
* @since 2.11.0
|
|
73
|
+
*/
|
|
74
|
+
exports.URI = 'Predicate';
|
|
75
|
+
/**
|
|
76
|
+
* @category instances
|
|
77
|
+
* @since 2.11.0
|
|
78
|
+
*/
|
|
79
|
+
var getSemigroupAny = function () { return ({
|
|
80
|
+
concat: function (first, second) { return (0, _function.pipe)(first, (0, exports.or)(second)); }
|
|
81
|
+
}); };
|
|
82
|
+
exports.getSemigroupAny = getSemigroupAny;
|
|
83
|
+
/**
|
|
84
|
+
* @category instances
|
|
85
|
+
* @since 2.11.0
|
|
86
|
+
*/
|
|
87
|
+
var getMonoidAny = function () { return ({
|
|
88
|
+
concat: (0, exports.getSemigroupAny)().concat,
|
|
89
|
+
empty: _function.constFalse
|
|
90
|
+
}); };
|
|
91
|
+
exports.getMonoidAny = getMonoidAny;
|
|
92
|
+
/**
|
|
93
|
+
* @category instances
|
|
94
|
+
* @since 2.11.0
|
|
95
|
+
*/
|
|
96
|
+
var getSemigroupAll = function () { return ({
|
|
97
|
+
concat: function (first, second) { return (0, _function.pipe)(first, (0, exports.and)(second)); }
|
|
98
|
+
}); };
|
|
99
|
+
exports.getSemigroupAll = getSemigroupAll;
|
|
100
|
+
/**
|
|
101
|
+
* @category instances
|
|
102
|
+
* @since 2.11.0
|
|
103
|
+
*/
|
|
104
|
+
var getMonoidAll = function () { return ({
|
|
105
|
+
concat: (0, exports.getSemigroupAll)().concat,
|
|
106
|
+
empty: _function.constTrue
|
|
107
|
+
}); };
|
|
108
|
+
exports.getMonoidAll = getMonoidAll;
|
|
109
|
+
/**
|
|
110
|
+
* @category instances
|
|
111
|
+
* @since 2.11.0
|
|
112
|
+
*/
|
|
113
|
+
exports.Contravariant = {
|
|
114
|
+
URI: exports.URI,
|
|
115
|
+
contramap: contramap_
|
|
116
|
+
};
|
|
117
|
+
// -------------------------------------------------------------------------------------
|
|
118
|
+
// utils
|
|
119
|
+
// -------------------------------------------------------------------------------------
|
|
120
|
+
/**
|
|
121
|
+
* @since 2.11.0
|
|
122
|
+
*/
|
|
123
|
+
var not = function (predicate) { return function (a) { return !predicate(a); }; };
|
|
124
|
+
exports.not = not;
|
|
125
|
+
/**
|
|
126
|
+
* @since 2.11.0
|
|
127
|
+
*/
|
|
128
|
+
var or = function (second) { return function (first) { return function (a) { return first(a) || second(a); }; }; };
|
|
129
|
+
exports.or = or;
|
|
130
|
+
/**
|
|
131
|
+
* @since 2.11.0
|
|
132
|
+
*/
|
|
133
|
+
var and = function (second) { return function (first) { return function (a) { return first(a) && second(a); }; }; };
|
|
134
|
+
exports.and = and;
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const Predicate$1 = /*@__PURE__*/getDefaultExportFromCjs(Predicate);
|
|
138
|
+
|
|
139
|
+
var Option = createCommonjsModule(function (module, exports) {
|
|
140
|
+
"use strict";
|
|
141
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
142
|
+
if (k2 === undefined) k2 = k;
|
|
143
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
144
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
145
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
146
|
+
}
|
|
147
|
+
Object.defineProperty(o, k2, desc);
|
|
148
|
+
}) : (function(o, m, k, k2) {
|
|
149
|
+
if (k2 === undefined) k2 = k;
|
|
150
|
+
o[k2] = m[k];
|
|
151
|
+
}));
|
|
152
|
+
var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
153
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
154
|
+
}) : function(o, v) {
|
|
155
|
+
o["default"] = v;
|
|
156
|
+
});
|
|
157
|
+
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
158
|
+
if (mod && mod.__esModule) return mod;
|
|
159
|
+
var result = {};
|
|
160
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
161
|
+
__setModuleDefault(result, mod);
|
|
162
|
+
return result;
|
|
163
|
+
};
|
|
164
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
165
|
+
exports.fromEither = exports.MonadThrow = exports.throwError = exports.Witherable = exports.wilt = exports.wither = exports.Traversable = exports.sequence = exports.traverse = exports.Filterable = exports.partitionMap = exports.partition = exports.filterMap = exports.filter = exports.Compactable = exports.separate = exports.compact = exports.Extend = exports.extend = exports.Alternative = exports.guard = exports.Zero = exports.zero = exports.Alt = exports.alt = exports.altW = exports.Foldable = exports.reduceRight = exports.foldMap = exports.reduce = exports.Monad = exports.Chain = exports.chain = exports.Applicative = exports.Apply = exports.ap = exports.Pointed = exports.of = exports.Functor = exports.map = exports.getMonoid = exports.getOrd = exports.getEq = exports.getShow = exports.URI = exports.getRight = exports.getLeft = exports.fromPredicate = exports.some = exports.none = void 0;
|
|
166
|
+
exports.getLastMonoid = exports.getFirstMonoid = exports.getApplyMonoid = exports.getApplySemigroup = exports.option = exports.mapNullable = exports.getRefinement = exports.sequenceArray = exports.traverseArray = exports.traverseArrayWithIndex = exports.traverseReadonlyArrayWithIndex = exports.traverseReadonlyNonEmptyArrayWithIndex = exports.ApT = exports.apS = exports.bind = exports.bindTo = exports.Do = exports.exists = exports.elem = exports.toUndefined = exports.toNullable = exports.chainNullableK = exports.fromNullableK = exports.tryCatchK = exports.tryCatch = exports.fromNullable = exports.chainFirstEitherK = exports.chainEitherK = exports.fromEitherK = exports.duplicate = exports.chainFirst = exports.flatten = exports.apSecond = exports.apFirst = exports.flap = exports.getOrElse = exports.getOrElseW = exports.fold = exports.match = exports.foldW = exports.matchW = exports.isNone = exports.isSome = exports.FromEither = void 0;
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
var _ = __importStar(internal);
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
// -------------------------------------------------------------------------------------
|
|
180
|
+
// constructors
|
|
181
|
+
// -------------------------------------------------------------------------------------
|
|
182
|
+
/**
|
|
183
|
+
* `None` doesn't have a constructor, instead you can use it directly as a value. Represents a missing value.
|
|
184
|
+
*
|
|
185
|
+
* @category constructors
|
|
186
|
+
* @since 2.0.0
|
|
187
|
+
*/
|
|
188
|
+
exports.none = _.none;
|
|
189
|
+
/**
|
|
190
|
+
* Constructs a `Some`. Represents an optional value that exists.
|
|
191
|
+
*
|
|
192
|
+
* @category constructors
|
|
193
|
+
* @since 2.0.0
|
|
194
|
+
*/
|
|
195
|
+
exports.some = _.some;
|
|
196
|
+
function fromPredicate(predicate) {
|
|
197
|
+
return function (a) { return (predicate(a) ? (0, exports.some)(a) : exports.none); };
|
|
198
|
+
}
|
|
199
|
+
exports.fromPredicate = fromPredicate;
|
|
200
|
+
/**
|
|
201
|
+
* Returns the `Left` value of an `Either` if possible.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* import { getLeft, none, some } from 'fp-ts/Option'
|
|
205
|
+
* import { right, left } from 'fp-ts/Either'
|
|
206
|
+
*
|
|
207
|
+
* assert.deepStrictEqual(getLeft(right(1)), none)
|
|
208
|
+
* assert.deepStrictEqual(getLeft(left('a')), some('a'))
|
|
209
|
+
*
|
|
210
|
+
* @category constructors
|
|
211
|
+
* @since 2.0.0
|
|
212
|
+
*/
|
|
213
|
+
var getLeft = function (ma) { return (ma._tag === 'Right' ? exports.none : (0, exports.some)(ma.left)); };
|
|
214
|
+
exports.getLeft = getLeft;
|
|
215
|
+
/**
|
|
216
|
+
* Returns the `Right` value of an `Either` if possible.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* import { getRight, none, some } from 'fp-ts/Option'
|
|
220
|
+
* import { right, left } from 'fp-ts/Either'
|
|
221
|
+
*
|
|
222
|
+
* assert.deepStrictEqual(getRight(right(1)), some(1))
|
|
223
|
+
* assert.deepStrictEqual(getRight(left('a')), none)
|
|
224
|
+
*
|
|
225
|
+
* @category constructors
|
|
226
|
+
* @since 2.0.0
|
|
227
|
+
*/
|
|
228
|
+
var getRight = function (ma) { return (ma._tag === 'Left' ? exports.none : (0, exports.some)(ma.right)); };
|
|
229
|
+
exports.getRight = getRight;
|
|
230
|
+
// -------------------------------------------------------------------------------------
|
|
231
|
+
// non-pipeables
|
|
232
|
+
// -------------------------------------------------------------------------------------
|
|
233
|
+
var _map = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.map)(f)); };
|
|
234
|
+
var _ap = function (fab, fa) { return (0, _function.pipe)(fab, (0, exports.ap)(fa)); };
|
|
235
|
+
var _chain = function (ma, f) { return (0, _function.pipe)(ma, (0, exports.chain)(f)); };
|
|
236
|
+
var _reduce = function (fa, b, f) { return (0, _function.pipe)(fa, (0, exports.reduce)(b, f)); };
|
|
237
|
+
var _foldMap = function (M) {
|
|
238
|
+
var foldMapM = (0, exports.foldMap)(M);
|
|
239
|
+
return function (fa, f) { return (0, _function.pipe)(fa, foldMapM(f)); };
|
|
240
|
+
};
|
|
241
|
+
var _reduceRight = function (fa, b, f) { return (0, _function.pipe)(fa, (0, exports.reduceRight)(b, f)); };
|
|
242
|
+
var _traverse = function (F) {
|
|
243
|
+
var traverseF = (0, exports.traverse)(F);
|
|
244
|
+
return function (ta, f) { return (0, _function.pipe)(ta, traverseF(f)); };
|
|
245
|
+
};
|
|
246
|
+
/* istanbul ignore next */
|
|
247
|
+
var _alt = function (fa, that) { return (0, _function.pipe)(fa, (0, exports.alt)(that)); };
|
|
248
|
+
var _filter = function (fa, predicate) { return (0, _function.pipe)(fa, (0, exports.filter)(predicate)); };
|
|
249
|
+
/* istanbul ignore next */
|
|
250
|
+
var _filterMap = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.filterMap)(f)); };
|
|
251
|
+
/* istanbul ignore next */
|
|
252
|
+
var _extend = function (wa, f) { return (0, _function.pipe)(wa, (0, exports.extend)(f)); };
|
|
253
|
+
/* istanbul ignore next */
|
|
254
|
+
var _partition = function (fa, predicate) {
|
|
255
|
+
return (0, _function.pipe)(fa, (0, exports.partition)(predicate));
|
|
256
|
+
};
|
|
257
|
+
/* istanbul ignore next */
|
|
258
|
+
var _partitionMap = function (fa, f) { return (0, _function.pipe)(fa, (0, exports.partitionMap)(f)); };
|
|
259
|
+
// -------------------------------------------------------------------------------------
|
|
260
|
+
// instances
|
|
261
|
+
// -------------------------------------------------------------------------------------
|
|
262
|
+
/**
|
|
263
|
+
* @category instances
|
|
264
|
+
* @since 2.0.0
|
|
265
|
+
*/
|
|
266
|
+
exports.URI = 'Option';
|
|
267
|
+
/**
|
|
268
|
+
* @category instances
|
|
269
|
+
* @since 2.0.0
|
|
270
|
+
*/
|
|
271
|
+
var getShow = function (S) { return ({
|
|
272
|
+
show: function (ma) { return ((0, exports.isNone)(ma) ? 'none' : "some(".concat(S.show(ma.value), ")")); }
|
|
273
|
+
}); };
|
|
274
|
+
exports.getShow = getShow;
|
|
275
|
+
/**
|
|
276
|
+
* @example
|
|
277
|
+
* import { none, some, getEq } from 'fp-ts/Option'
|
|
278
|
+
* import * as N from 'fp-ts/number'
|
|
279
|
+
*
|
|
280
|
+
* const E = getEq(N.Eq)
|
|
281
|
+
* assert.strictEqual(E.equals(none, none), true)
|
|
282
|
+
* assert.strictEqual(E.equals(none, some(1)), false)
|
|
283
|
+
* assert.strictEqual(E.equals(some(1), none), false)
|
|
284
|
+
* assert.strictEqual(E.equals(some(1), some(2)), false)
|
|
285
|
+
* assert.strictEqual(E.equals(some(1), some(1)), true)
|
|
286
|
+
*
|
|
287
|
+
* @category instances
|
|
288
|
+
* @since 2.0.0
|
|
289
|
+
*/
|
|
290
|
+
var getEq = function (E) { return ({
|
|
291
|
+
equals: function (x, y) { return x === y || ((0, exports.isNone)(x) ? (0, exports.isNone)(y) : (0, exports.isNone)(y) ? false : E.equals(x.value, y.value)); }
|
|
292
|
+
}); };
|
|
293
|
+
exports.getEq = getEq;
|
|
294
|
+
/**
|
|
295
|
+
* The `Ord` instance allows `Option` values to be compared with
|
|
296
|
+
* `compare`, whenever there is an `Ord` instance for
|
|
297
|
+
* the type the `Option` contains.
|
|
298
|
+
*
|
|
299
|
+
* `None` is considered to be less than any `Some` value.
|
|
300
|
+
*
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* import { none, some, getOrd } from 'fp-ts/Option'
|
|
304
|
+
* import * as N from 'fp-ts/number'
|
|
305
|
+
*
|
|
306
|
+
* const O = getOrd(N.Ord)
|
|
307
|
+
* assert.strictEqual(O.compare(none, none), 0)
|
|
308
|
+
* assert.strictEqual(O.compare(none, some(1)), -1)
|
|
309
|
+
* assert.strictEqual(O.compare(some(1), none), 1)
|
|
310
|
+
* assert.strictEqual(O.compare(some(1), some(2)), -1)
|
|
311
|
+
* assert.strictEqual(O.compare(some(1), some(1)), 0)
|
|
312
|
+
*
|
|
313
|
+
* @category instances
|
|
314
|
+
* @since 2.0.0
|
|
315
|
+
*/
|
|
316
|
+
var getOrd = function (O) { return ({
|
|
317
|
+
equals: (0, exports.getEq)(O).equals,
|
|
318
|
+
compare: function (x, y) { return (x === y ? 0 : (0, exports.isSome)(x) ? ((0, exports.isSome)(y) ? O.compare(x.value, y.value) : 1) : -1); }
|
|
319
|
+
}); };
|
|
320
|
+
exports.getOrd = getOrd;
|
|
321
|
+
/**
|
|
322
|
+
* Monoid returning the left-most non-`None` value. If both operands are `Some`s then the inner values are
|
|
323
|
+
* concatenated using the provided `Semigroup`
|
|
324
|
+
*
|
|
325
|
+
* | x | y | concat(x, y) |
|
|
326
|
+
* | ------- | ------- | ------------------ |
|
|
327
|
+
* | none | none | none |
|
|
328
|
+
* | some(a) | none | some(a) |
|
|
329
|
+
* | none | some(b) | some(b) |
|
|
330
|
+
* | some(a) | some(b) | some(concat(a, b)) |
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* import { getMonoid, some, none } from 'fp-ts/Option'
|
|
334
|
+
* import { SemigroupSum } from 'fp-ts/number'
|
|
335
|
+
*
|
|
336
|
+
* const M = getMonoid(SemigroupSum)
|
|
337
|
+
* assert.deepStrictEqual(M.concat(none, none), none)
|
|
338
|
+
* assert.deepStrictEqual(M.concat(some(1), none), some(1))
|
|
339
|
+
* assert.deepStrictEqual(M.concat(none, some(1)), some(1))
|
|
340
|
+
* assert.deepStrictEqual(M.concat(some(1), some(2)), some(3))
|
|
341
|
+
*
|
|
342
|
+
* @category instances
|
|
343
|
+
* @since 2.0.0
|
|
344
|
+
*/
|
|
345
|
+
var getMonoid = function (S) { return ({
|
|
346
|
+
concat: function (x, y) { return ((0, exports.isNone)(x) ? y : (0, exports.isNone)(y) ? x : (0, exports.some)(S.concat(x.value, y.value))); },
|
|
347
|
+
empty: exports.none
|
|
348
|
+
}); };
|
|
349
|
+
exports.getMonoid = getMonoid;
|
|
350
|
+
/**
|
|
351
|
+
* @category instance operations
|
|
352
|
+
* @since 2.0.0
|
|
353
|
+
*/
|
|
354
|
+
var map = function (f) { return function (fa) {
|
|
355
|
+
return (0, exports.isNone)(fa) ? exports.none : (0, exports.some)(f(fa.value));
|
|
356
|
+
}; };
|
|
357
|
+
exports.map = map;
|
|
358
|
+
/**
|
|
359
|
+
* @category instances
|
|
360
|
+
* @since 2.7.0
|
|
361
|
+
*/
|
|
362
|
+
exports.Functor = {
|
|
363
|
+
URI: exports.URI,
|
|
364
|
+
map: _map
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* @category instance operations
|
|
368
|
+
* @since 2.7.0
|
|
369
|
+
*/
|
|
370
|
+
exports.of = exports.some;
|
|
371
|
+
/**
|
|
372
|
+
* @category instances
|
|
373
|
+
* @since 2.10.0
|
|
374
|
+
*/
|
|
375
|
+
exports.Pointed = {
|
|
376
|
+
URI: exports.URI,
|
|
377
|
+
of: exports.of
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* @category instance operations
|
|
381
|
+
* @since 2.0.0
|
|
382
|
+
*/
|
|
383
|
+
var ap = function (fa) { return function (fab) {
|
|
384
|
+
return (0, exports.isNone)(fab) ? exports.none : (0, exports.isNone)(fa) ? exports.none : (0, exports.some)(fab.value(fa.value));
|
|
385
|
+
}; };
|
|
386
|
+
exports.ap = ap;
|
|
387
|
+
/**
|
|
388
|
+
* @category instances
|
|
389
|
+
* @since 2.10.0
|
|
390
|
+
*/
|
|
391
|
+
exports.Apply = {
|
|
392
|
+
URI: exports.URI,
|
|
393
|
+
map: _map,
|
|
394
|
+
ap: _ap
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* @category instances
|
|
398
|
+
* @since 2.7.0
|
|
399
|
+
*/
|
|
400
|
+
exports.Applicative = {
|
|
401
|
+
URI: exports.URI,
|
|
402
|
+
map: _map,
|
|
403
|
+
ap: _ap,
|
|
404
|
+
of: exports.of
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* Composes computations in sequence, using the return value of one computation to determine the next computation.
|
|
408
|
+
*
|
|
409
|
+
* @category instance operations
|
|
410
|
+
* @since 2.0.0
|
|
411
|
+
*/
|
|
412
|
+
var chain = function (f) { return function (ma) {
|
|
413
|
+
return (0, exports.isNone)(ma) ? exports.none : f(ma.value);
|
|
414
|
+
}; };
|
|
415
|
+
exports.chain = chain;
|
|
416
|
+
/**
|
|
417
|
+
* @category instances
|
|
418
|
+
* @since 2.10.0
|
|
419
|
+
*/
|
|
420
|
+
exports.Chain = {
|
|
421
|
+
URI: exports.URI,
|
|
422
|
+
map: _map,
|
|
423
|
+
ap: _ap,
|
|
424
|
+
chain: _chain
|
|
425
|
+
};
|
|
426
|
+
/**
|
|
427
|
+
* @category instances
|
|
428
|
+
* @since 2.7.0
|
|
429
|
+
*/
|
|
430
|
+
exports.Monad = {
|
|
431
|
+
URI: exports.URI,
|
|
432
|
+
map: _map,
|
|
433
|
+
ap: _ap,
|
|
434
|
+
of: exports.of,
|
|
435
|
+
chain: _chain
|
|
436
|
+
};
|
|
437
|
+
/**
|
|
438
|
+
* @category instance operations
|
|
439
|
+
* @since 2.0.0
|
|
440
|
+
*/
|
|
441
|
+
var reduce = function (b, f) { return function (fa) {
|
|
442
|
+
return (0, exports.isNone)(fa) ? b : f(b, fa.value);
|
|
443
|
+
}; };
|
|
444
|
+
exports.reduce = reduce;
|
|
445
|
+
/**
|
|
446
|
+
* @category instance operations
|
|
447
|
+
* @since 2.0.0
|
|
448
|
+
*/
|
|
449
|
+
var foldMap = function (M) { return function (f) { return function (fa) {
|
|
450
|
+
return (0, exports.isNone)(fa) ? M.empty : f(fa.value);
|
|
451
|
+
}; }; };
|
|
452
|
+
exports.foldMap = foldMap;
|
|
453
|
+
/**
|
|
454
|
+
* @category instance operations
|
|
455
|
+
* @since 2.0.0
|
|
456
|
+
*/
|
|
457
|
+
var reduceRight = function (b, f) { return function (fa) {
|
|
458
|
+
return (0, exports.isNone)(fa) ? b : f(fa.value, b);
|
|
459
|
+
}; };
|
|
460
|
+
exports.reduceRight = reduceRight;
|
|
461
|
+
/**
|
|
462
|
+
* @category instances
|
|
463
|
+
* @since 2.7.0
|
|
464
|
+
*/
|
|
465
|
+
exports.Foldable = {
|
|
466
|
+
URI: exports.URI,
|
|
467
|
+
reduce: _reduce,
|
|
468
|
+
foldMap: _foldMap,
|
|
469
|
+
reduceRight: _reduceRight
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Less strict version of [`alt`](#alt).
|
|
473
|
+
*
|
|
474
|
+
* @category instance operations
|
|
475
|
+
* @since 2.9.0
|
|
476
|
+
*/
|
|
477
|
+
var altW = function (that) { return function (fa) {
|
|
478
|
+
return (0, exports.isNone)(fa) ? that() : fa;
|
|
479
|
+
}; };
|
|
480
|
+
exports.altW = altW;
|
|
481
|
+
/**
|
|
482
|
+
* Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
|
|
483
|
+
* types of kind `* -> *`.
|
|
484
|
+
*
|
|
485
|
+
* In case of `Option` returns the left-most non-`None` value.
|
|
486
|
+
*
|
|
487
|
+
* @example
|
|
488
|
+
* import * as O from 'fp-ts/Option'
|
|
489
|
+
* import { pipe } from 'fp-ts/function'
|
|
490
|
+
*
|
|
491
|
+
* assert.deepStrictEqual(
|
|
492
|
+
* pipe(
|
|
493
|
+
* O.some('a'),
|
|
494
|
+
* O.alt(() => O.some('b'))
|
|
495
|
+
* ),
|
|
496
|
+
* O.some('a')
|
|
497
|
+
* )
|
|
498
|
+
* assert.deepStrictEqual(
|
|
499
|
+
* pipe(
|
|
500
|
+
* O.none,
|
|
501
|
+
* O.alt(() => O.some('b'))
|
|
502
|
+
* ),
|
|
503
|
+
* O.some('b')
|
|
504
|
+
* )
|
|
505
|
+
*
|
|
506
|
+
* @category instance operations
|
|
507
|
+
* @since 2.0.0
|
|
508
|
+
*/
|
|
509
|
+
exports.alt = exports.altW;
|
|
510
|
+
/**
|
|
511
|
+
* @category instances
|
|
512
|
+
* @since 2.7.0
|
|
513
|
+
*/
|
|
514
|
+
exports.Alt = {
|
|
515
|
+
URI: exports.URI,
|
|
516
|
+
map: _map,
|
|
517
|
+
alt: _alt
|
|
518
|
+
};
|
|
519
|
+
/**
|
|
520
|
+
* @category instance operations
|
|
521
|
+
* @since 2.7.0
|
|
522
|
+
*/
|
|
523
|
+
var zero = function () { return exports.none; };
|
|
524
|
+
exports.zero = zero;
|
|
525
|
+
/**
|
|
526
|
+
* @category instances
|
|
527
|
+
* @since 2.11.0
|
|
528
|
+
*/
|
|
529
|
+
exports.Zero = {
|
|
530
|
+
URI: exports.URI,
|
|
531
|
+
zero: exports.zero
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* @category constructors
|
|
535
|
+
* @since 2.11.0
|
|
536
|
+
*/
|
|
537
|
+
exports.guard = (0, Zero.guard)(exports.Zero, exports.Pointed);
|
|
538
|
+
/**
|
|
539
|
+
* @category instances
|
|
540
|
+
* @since 2.7.0
|
|
541
|
+
*/
|
|
542
|
+
exports.Alternative = {
|
|
543
|
+
URI: exports.URI,
|
|
544
|
+
map: _map,
|
|
545
|
+
ap: _ap,
|
|
546
|
+
of: exports.of,
|
|
547
|
+
alt: _alt,
|
|
548
|
+
zero: exports.zero
|
|
549
|
+
};
|
|
550
|
+
/**
|
|
551
|
+
* @category instance operations
|
|
552
|
+
* @since 2.0.0
|
|
553
|
+
*/
|
|
554
|
+
var extend = function (f) { return function (wa) {
|
|
555
|
+
return (0, exports.isNone)(wa) ? exports.none : (0, exports.some)(f(wa));
|
|
556
|
+
}; };
|
|
557
|
+
exports.extend = extend;
|
|
558
|
+
/**
|
|
559
|
+
* @category instances
|
|
560
|
+
* @since 2.7.0
|
|
561
|
+
*/
|
|
562
|
+
exports.Extend = {
|
|
563
|
+
URI: exports.URI,
|
|
564
|
+
map: _map,
|
|
565
|
+
extend: _extend
|
|
566
|
+
};
|
|
567
|
+
/**
|
|
568
|
+
* @category instance operations
|
|
569
|
+
* @since 2.0.0
|
|
570
|
+
*/
|
|
571
|
+
exports.compact = (0, exports.chain)(_function.identity);
|
|
572
|
+
var defaultSeparated = /*#__PURE__*/ (0, Separated.separated)(exports.none, exports.none);
|
|
573
|
+
/**
|
|
574
|
+
* @category instance operations
|
|
575
|
+
* @since 2.0.0
|
|
576
|
+
*/
|
|
577
|
+
var separate = function (ma) {
|
|
578
|
+
return (0, exports.isNone)(ma) ? defaultSeparated : (0, Separated.separated)((0, exports.getLeft)(ma.value), (0, exports.getRight)(ma.value));
|
|
579
|
+
};
|
|
580
|
+
exports.separate = separate;
|
|
581
|
+
/**
|
|
582
|
+
* @category instances
|
|
583
|
+
* @since 2.7.0
|
|
584
|
+
*/
|
|
585
|
+
exports.Compactable = {
|
|
586
|
+
URI: exports.URI,
|
|
587
|
+
compact: exports.compact,
|
|
588
|
+
separate: exports.separate
|
|
589
|
+
};
|
|
590
|
+
/**
|
|
591
|
+
* @category instance operations
|
|
592
|
+
* @since 2.0.0
|
|
593
|
+
*/
|
|
594
|
+
var filter = function (predicate) { return function (fa) { return ((0, exports.isNone)(fa) ? exports.none : predicate(fa.value) ? fa : exports.none); }; };
|
|
595
|
+
exports.filter = filter;
|
|
596
|
+
/**
|
|
597
|
+
* @category instance operations
|
|
598
|
+
* @since 2.0.0
|
|
599
|
+
*/
|
|
600
|
+
var filterMap = function (f) { return function (fa) {
|
|
601
|
+
return (0, exports.isNone)(fa) ? exports.none : f(fa.value);
|
|
602
|
+
}; };
|
|
603
|
+
exports.filterMap = filterMap;
|
|
604
|
+
/**
|
|
605
|
+
* @category instance operations
|
|
606
|
+
* @since 2.0.0
|
|
607
|
+
*/
|
|
608
|
+
var partition = function (predicate) { return function (fa) { return (0, Separated.separated)(_filter(fa, (0, Predicate.not)(predicate)), _filter(fa, predicate)); }; };
|
|
609
|
+
exports.partition = partition;
|
|
610
|
+
/**
|
|
611
|
+
* @category instance operations
|
|
612
|
+
* @since 2.0.0
|
|
613
|
+
*/
|
|
614
|
+
var partitionMap = function (f) { return (0, _function.flow)((0, exports.map)(f), exports.separate); };
|
|
615
|
+
exports.partitionMap = partitionMap;
|
|
616
|
+
/**
|
|
617
|
+
* @category instances
|
|
618
|
+
* @since 2.7.0
|
|
619
|
+
*/
|
|
620
|
+
exports.Filterable = {
|
|
621
|
+
URI: exports.URI,
|
|
622
|
+
map: _map,
|
|
623
|
+
compact: exports.compact,
|
|
624
|
+
separate: exports.separate,
|
|
625
|
+
filter: _filter,
|
|
626
|
+
filterMap: _filterMap,
|
|
627
|
+
partition: _partition,
|
|
628
|
+
partitionMap: _partitionMap
|
|
629
|
+
};
|
|
630
|
+
/**
|
|
631
|
+
* @category instance operations
|
|
632
|
+
* @since 2.6.3
|
|
633
|
+
*/
|
|
634
|
+
var traverse = function (F) { return function (f) { return function (ta) { return ((0, exports.isNone)(ta) ? F.of(exports.none) : F.map(f(ta.value), exports.some)); }; }; };
|
|
635
|
+
exports.traverse = traverse;
|
|
636
|
+
/**
|
|
637
|
+
* @category instance operations
|
|
638
|
+
* @since 2.6.3
|
|
639
|
+
*/
|
|
640
|
+
var sequence = function (F) { return function (ta) { return ((0, exports.isNone)(ta) ? F.of(exports.none) : F.map(ta.value, exports.some)); }; };
|
|
641
|
+
exports.sequence = sequence;
|
|
642
|
+
/**
|
|
643
|
+
* @category instances
|
|
644
|
+
* @since 2.7.0
|
|
645
|
+
*/
|
|
646
|
+
exports.Traversable = {
|
|
647
|
+
URI: exports.URI,
|
|
648
|
+
map: _map,
|
|
649
|
+
reduce: _reduce,
|
|
650
|
+
foldMap: _foldMap,
|
|
651
|
+
reduceRight: _reduceRight,
|
|
652
|
+
traverse: _traverse,
|
|
653
|
+
sequence: exports.sequence
|
|
654
|
+
};
|
|
655
|
+
var _wither = /*#__PURE__*/ (0, Witherable.witherDefault)(exports.Traversable, exports.Compactable);
|
|
656
|
+
var _wilt = /*#__PURE__*/ (0, Witherable.wiltDefault)(exports.Traversable, exports.Compactable);
|
|
657
|
+
/**
|
|
658
|
+
* @category instance operations
|
|
659
|
+
* @since 2.6.5
|
|
660
|
+
*/
|
|
661
|
+
var wither = function (F) {
|
|
662
|
+
var _witherF = _wither(F);
|
|
663
|
+
return function (f) { return function (fa) { return _witherF(fa, f); }; };
|
|
664
|
+
};
|
|
665
|
+
exports.wither = wither;
|
|
666
|
+
/**
|
|
667
|
+
* @category instance operations
|
|
668
|
+
* @since 2.6.5
|
|
669
|
+
*/
|
|
670
|
+
var wilt = function (F) {
|
|
671
|
+
var _wiltF = _wilt(F);
|
|
672
|
+
return function (f) { return function (fa) { return _wiltF(fa, f); }; };
|
|
673
|
+
};
|
|
674
|
+
exports.wilt = wilt;
|
|
675
|
+
/**
|
|
676
|
+
* @category instances
|
|
677
|
+
* @since 2.7.0
|
|
678
|
+
*/
|
|
679
|
+
exports.Witherable = {
|
|
680
|
+
URI: exports.URI,
|
|
681
|
+
map: _map,
|
|
682
|
+
reduce: _reduce,
|
|
683
|
+
foldMap: _foldMap,
|
|
684
|
+
reduceRight: _reduceRight,
|
|
685
|
+
traverse: _traverse,
|
|
686
|
+
sequence: exports.sequence,
|
|
687
|
+
compact: exports.compact,
|
|
688
|
+
separate: exports.separate,
|
|
689
|
+
filter: _filter,
|
|
690
|
+
filterMap: _filterMap,
|
|
691
|
+
partition: _partition,
|
|
692
|
+
partitionMap: _partitionMap,
|
|
693
|
+
wither: _wither,
|
|
694
|
+
wilt: _wilt
|
|
695
|
+
};
|
|
696
|
+
/**
|
|
697
|
+
* @category instance operations
|
|
698
|
+
* @since 2.7.0
|
|
699
|
+
*/
|
|
700
|
+
var throwError = function () { return exports.none; };
|
|
701
|
+
exports.throwError = throwError;
|
|
702
|
+
/**
|
|
703
|
+
* @category instances
|
|
704
|
+
* @since 2.7.0
|
|
705
|
+
*/
|
|
706
|
+
exports.MonadThrow = {
|
|
707
|
+
URI: exports.URI,
|
|
708
|
+
map: _map,
|
|
709
|
+
ap: _ap,
|
|
710
|
+
of: exports.of,
|
|
711
|
+
chain: _chain,
|
|
712
|
+
throwError: exports.throwError
|
|
713
|
+
};
|
|
714
|
+
/**
|
|
715
|
+
* Transforms an `Either` to an `Option` discarding the error.
|
|
716
|
+
*
|
|
717
|
+
* Alias of [getRight](#getright)
|
|
718
|
+
*
|
|
719
|
+
* @category natural transformations
|
|
720
|
+
* @since 2.0.0
|
|
721
|
+
*/
|
|
722
|
+
exports.fromEither = exports.getRight;
|
|
723
|
+
/**
|
|
724
|
+
* @category instances
|
|
725
|
+
* @since 2.11.0
|
|
726
|
+
*/
|
|
727
|
+
exports.FromEither = {
|
|
728
|
+
URI: exports.URI,
|
|
729
|
+
fromEither: exports.fromEither
|
|
730
|
+
};
|
|
731
|
+
// -------------------------------------------------------------------------------------
|
|
732
|
+
// refinements
|
|
733
|
+
// -------------------------------------------------------------------------------------
|
|
734
|
+
/**
|
|
735
|
+
* Returns `true` if the option is an instance of `Some`, `false` otherwise.
|
|
736
|
+
*
|
|
737
|
+
* @example
|
|
738
|
+
* import { some, none, isSome } from 'fp-ts/Option'
|
|
739
|
+
*
|
|
740
|
+
* assert.strictEqual(isSome(some(1)), true)
|
|
741
|
+
* assert.strictEqual(isSome(none), false)
|
|
742
|
+
*
|
|
743
|
+
* @category refinements
|
|
744
|
+
* @since 2.0.0
|
|
745
|
+
*/
|
|
746
|
+
exports.isSome = _.isSome;
|
|
747
|
+
/**
|
|
748
|
+
* Returns `true` if the option is `None`, `false` otherwise.
|
|
749
|
+
*
|
|
750
|
+
* @example
|
|
751
|
+
* import { some, none, isNone } from 'fp-ts/Option'
|
|
752
|
+
*
|
|
753
|
+
* assert.strictEqual(isNone(some(1)), false)
|
|
754
|
+
* assert.strictEqual(isNone(none), true)
|
|
755
|
+
*
|
|
756
|
+
* @category refinements
|
|
757
|
+
* @since 2.0.0
|
|
758
|
+
*/
|
|
759
|
+
var isNone = function (fa) { return fa._tag === 'None'; };
|
|
760
|
+
exports.isNone = isNone;
|
|
761
|
+
// -------------------------------------------------------------------------------------
|
|
762
|
+
// destructors
|
|
763
|
+
// -------------------------------------------------------------------------------------
|
|
764
|
+
/**
|
|
765
|
+
* Less strict version of [`match`](#match).
|
|
766
|
+
*
|
|
767
|
+
* @category destructors
|
|
768
|
+
* @since 2.10.0
|
|
769
|
+
*/
|
|
770
|
+
var matchW = function (onNone, onSome) { return function (ma) {
|
|
771
|
+
return (0, exports.isNone)(ma) ? onNone() : onSome(ma.value);
|
|
772
|
+
}; };
|
|
773
|
+
exports.matchW = matchW;
|
|
774
|
+
/**
|
|
775
|
+
* Alias of [`matchW`](#matchw).
|
|
776
|
+
*
|
|
777
|
+
* @category destructors
|
|
778
|
+
* @since 2.10.0
|
|
779
|
+
*/
|
|
780
|
+
exports.foldW = exports.matchW;
|
|
781
|
+
/**
|
|
782
|
+
* Takes a (lazy) default value, a function, and an `Option` value, if the `Option` value is `None` the default value is
|
|
783
|
+
* returned, otherwise the function is applied to the value inside the `Some` and the result is returned.
|
|
784
|
+
*
|
|
785
|
+
* @example
|
|
786
|
+
* import { some, none, match } from 'fp-ts/Option'
|
|
787
|
+
* import { pipe } from 'fp-ts/function'
|
|
788
|
+
*
|
|
789
|
+
* assert.strictEqual(
|
|
790
|
+
* pipe(
|
|
791
|
+
* some(1),
|
|
792
|
+
* match(() => 'a none', a => `a some containing ${a}`)
|
|
793
|
+
* ),
|
|
794
|
+
* 'a some containing 1'
|
|
795
|
+
* )
|
|
796
|
+
*
|
|
797
|
+
* assert.strictEqual(
|
|
798
|
+
* pipe(
|
|
799
|
+
* none,
|
|
800
|
+
* match(() => 'a none', a => `a some containing ${a}`)
|
|
801
|
+
* ),
|
|
802
|
+
* 'a none'
|
|
803
|
+
* )
|
|
804
|
+
*
|
|
805
|
+
* @category destructors
|
|
806
|
+
* @since 2.10.0
|
|
807
|
+
*/
|
|
808
|
+
exports.match = exports.matchW;
|
|
809
|
+
/**
|
|
810
|
+
* Alias of [`match`](#match).
|
|
811
|
+
*
|
|
812
|
+
* @category destructors
|
|
813
|
+
* @since 2.0.0
|
|
814
|
+
*/
|
|
815
|
+
exports.fold = exports.match;
|
|
816
|
+
/**
|
|
817
|
+
* Less strict version of [`getOrElse`](#getorelse).
|
|
818
|
+
*
|
|
819
|
+
* @category destructors
|
|
820
|
+
* @since 2.6.0
|
|
821
|
+
*/
|
|
822
|
+
var getOrElseW = function (onNone) { return function (ma) { return ((0, exports.isNone)(ma) ? onNone() : ma.value); }; };
|
|
823
|
+
exports.getOrElseW = getOrElseW;
|
|
824
|
+
/**
|
|
825
|
+
* Extracts the value out of the structure, if it exists. Otherwise returns the given default value
|
|
826
|
+
*
|
|
827
|
+
* @example
|
|
828
|
+
* import { some, none, getOrElse } from 'fp-ts/Option'
|
|
829
|
+
* import { pipe } from 'fp-ts/function'
|
|
830
|
+
*
|
|
831
|
+
* assert.strictEqual(
|
|
832
|
+
* pipe(
|
|
833
|
+
* some(1),
|
|
834
|
+
* getOrElse(() => 0)
|
|
835
|
+
* ),
|
|
836
|
+
* 1
|
|
837
|
+
* )
|
|
838
|
+
* assert.strictEqual(
|
|
839
|
+
* pipe(
|
|
840
|
+
* none,
|
|
841
|
+
* getOrElse(() => 0)
|
|
842
|
+
* ),
|
|
843
|
+
* 0
|
|
844
|
+
* )
|
|
845
|
+
*
|
|
846
|
+
* @category destructors
|
|
847
|
+
* @since 2.0.0
|
|
848
|
+
*/
|
|
849
|
+
exports.getOrElse = exports.getOrElseW;
|
|
850
|
+
// -------------------------------------------------------------------------------------
|
|
851
|
+
// combinators
|
|
852
|
+
// -------------------------------------------------------------------------------------
|
|
853
|
+
/**
|
|
854
|
+
* Derivable from `Functor`.
|
|
855
|
+
*
|
|
856
|
+
* @category combinators
|
|
857
|
+
* @since 2.10.0
|
|
858
|
+
*/
|
|
859
|
+
exports.flap = (0, Functor.flap)(exports.Functor);
|
|
860
|
+
/**
|
|
861
|
+
* Combine two effectful actions, keeping only the result of the first.
|
|
862
|
+
*
|
|
863
|
+
* Derivable from `Apply`.
|
|
864
|
+
*
|
|
865
|
+
* @category combinators
|
|
866
|
+
* @since 2.0.0
|
|
867
|
+
*/
|
|
868
|
+
exports.apFirst = (0, Apply.apFirst)(exports.Apply);
|
|
869
|
+
/**
|
|
870
|
+
* Combine two effectful actions, keeping only the result of the second.
|
|
871
|
+
*
|
|
872
|
+
* Derivable from `Apply`.
|
|
873
|
+
*
|
|
874
|
+
* @category combinators
|
|
875
|
+
* @since 2.0.0
|
|
876
|
+
*/
|
|
877
|
+
exports.apSecond = (0, Apply.apSecond)(exports.Apply);
|
|
878
|
+
/**
|
|
879
|
+
* Derivable from `Chain`.
|
|
880
|
+
*
|
|
881
|
+
* @category combinators
|
|
882
|
+
* @since 2.0.0
|
|
883
|
+
*/
|
|
884
|
+
exports.flatten = exports.compact;
|
|
885
|
+
/**
|
|
886
|
+
* Composes computations in sequence, using the return value of one computation to determine the next computation and
|
|
887
|
+
* keeping only the result of the first.
|
|
888
|
+
*
|
|
889
|
+
* Derivable from `Chain`.
|
|
890
|
+
*
|
|
891
|
+
* @category combinators
|
|
892
|
+
* @since 2.0.0
|
|
893
|
+
*/
|
|
894
|
+
exports.chainFirst = (0, Chain.chainFirst)(exports.Chain);
|
|
895
|
+
/**
|
|
896
|
+
* Derivable from `Extend`.
|
|
897
|
+
*
|
|
898
|
+
* @category combinators
|
|
899
|
+
* @since 2.0.0
|
|
900
|
+
*/
|
|
901
|
+
exports.duplicate = (0, exports.extend)(_function.identity);
|
|
902
|
+
/**
|
|
903
|
+
* @category combinators
|
|
904
|
+
* @since 2.11.0
|
|
905
|
+
*/
|
|
906
|
+
exports.fromEitherK = (0, FromEither.fromEitherK)(exports.FromEither);
|
|
907
|
+
/**
|
|
908
|
+
* @category combinators
|
|
909
|
+
* @since 2.11.0
|
|
910
|
+
*/
|
|
911
|
+
exports.chainEitherK = (0, FromEither.chainEitherK)(exports.FromEither, exports.Chain);
|
|
912
|
+
/**
|
|
913
|
+
* @category combinators
|
|
914
|
+
* @since 2.12.0
|
|
915
|
+
*/
|
|
916
|
+
exports.chainFirstEitherK = (0, FromEither.chainFirstEitherK)(exports.FromEither, exports.Chain);
|
|
917
|
+
// -------------------------------------------------------------------------------------
|
|
918
|
+
// interop
|
|
919
|
+
// -------------------------------------------------------------------------------------
|
|
920
|
+
/**
|
|
921
|
+
* Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise
|
|
922
|
+
* returns the value wrapped in a `Some`.
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* import { none, some, fromNullable } from 'fp-ts/Option'
|
|
926
|
+
*
|
|
927
|
+
* assert.deepStrictEqual(fromNullable(undefined), none)
|
|
928
|
+
* assert.deepStrictEqual(fromNullable(null), none)
|
|
929
|
+
* assert.deepStrictEqual(fromNullable(1), some(1))
|
|
930
|
+
*
|
|
931
|
+
* @category interop
|
|
932
|
+
* @since 2.0.0
|
|
933
|
+
*/
|
|
934
|
+
var fromNullable = function (a) { return (a == null ? exports.none : (0, exports.some)(a)); };
|
|
935
|
+
exports.fromNullable = fromNullable;
|
|
936
|
+
/**
|
|
937
|
+
* Transforms an exception into an `Option`. If `f` throws, returns `None`, otherwise returns the output wrapped in a
|
|
938
|
+
* `Some`.
|
|
939
|
+
*
|
|
940
|
+
* See also [`tryCatchK`](#trycatchk).
|
|
941
|
+
*
|
|
942
|
+
* @example
|
|
943
|
+
* import { none, some, tryCatch } from 'fp-ts/Option'
|
|
944
|
+
*
|
|
945
|
+
* assert.deepStrictEqual(
|
|
946
|
+
* tryCatch(() => {
|
|
947
|
+
* throw new Error()
|
|
948
|
+
* }),
|
|
949
|
+
* none
|
|
950
|
+
* )
|
|
951
|
+
* assert.deepStrictEqual(tryCatch(() => 1), some(1))
|
|
952
|
+
*
|
|
953
|
+
* @category interop
|
|
954
|
+
* @since 2.0.0
|
|
955
|
+
*/
|
|
956
|
+
var tryCatch = function (f) {
|
|
957
|
+
try {
|
|
958
|
+
return (0, exports.some)(f());
|
|
959
|
+
}
|
|
960
|
+
catch (e) {
|
|
961
|
+
return exports.none;
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
exports.tryCatch = tryCatch;
|
|
965
|
+
/**
|
|
966
|
+
* Converts a function that may throw to one returning a `Option`.
|
|
967
|
+
*
|
|
968
|
+
* @category interop
|
|
969
|
+
* @since 2.10.0
|
|
970
|
+
*/
|
|
971
|
+
var tryCatchK = function (f) { return function () {
|
|
972
|
+
var a = [];
|
|
973
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
974
|
+
a[_i] = arguments[_i];
|
|
975
|
+
}
|
|
976
|
+
return (0, exports.tryCatch)(function () { return f.apply(void 0, a); });
|
|
977
|
+
}; };
|
|
978
|
+
exports.tryCatchK = tryCatchK;
|
|
979
|
+
/**
|
|
980
|
+
* Returns a *smart constructor* from a function that returns a nullable value.
|
|
981
|
+
*
|
|
982
|
+
* @example
|
|
983
|
+
* import { fromNullableK, none, some } from 'fp-ts/Option'
|
|
984
|
+
*
|
|
985
|
+
* const f = (s: string): number | undefined => {
|
|
986
|
+
* const n = parseFloat(s)
|
|
987
|
+
* return isNaN(n) ? undefined : n
|
|
988
|
+
* }
|
|
989
|
+
*
|
|
990
|
+
* const g = fromNullableK(f)
|
|
991
|
+
*
|
|
992
|
+
* assert.deepStrictEqual(g('1'), some(1))
|
|
993
|
+
* assert.deepStrictEqual(g('a'), none)
|
|
994
|
+
*
|
|
995
|
+
* @category interop
|
|
996
|
+
* @since 2.9.0
|
|
997
|
+
*/
|
|
998
|
+
var fromNullableK = function (f) { return (0, _function.flow)(f, exports.fromNullable); };
|
|
999
|
+
exports.fromNullableK = fromNullableK;
|
|
1000
|
+
/**
|
|
1001
|
+
* This is `chain` + `fromNullable`, useful when working with optional values.
|
|
1002
|
+
*
|
|
1003
|
+
* @example
|
|
1004
|
+
* import { some, none, fromNullable, chainNullableK } from 'fp-ts/Option'
|
|
1005
|
+
* import { pipe } from 'fp-ts/function'
|
|
1006
|
+
*
|
|
1007
|
+
* interface Employee {
|
|
1008
|
+
* readonly company?: {
|
|
1009
|
+
* readonly address?: {
|
|
1010
|
+
* readonly street?: {
|
|
1011
|
+
* readonly name?: string
|
|
1012
|
+
* }
|
|
1013
|
+
* }
|
|
1014
|
+
* }
|
|
1015
|
+
* }
|
|
1016
|
+
*
|
|
1017
|
+
* const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }
|
|
1018
|
+
*
|
|
1019
|
+
* assert.deepStrictEqual(
|
|
1020
|
+
* pipe(
|
|
1021
|
+
* fromNullable(employee1.company),
|
|
1022
|
+
* chainNullableK(company => company.address),
|
|
1023
|
+
* chainNullableK(address => address.street),
|
|
1024
|
+
* chainNullableK(street => street.name)
|
|
1025
|
+
* ),
|
|
1026
|
+
* some('high street')
|
|
1027
|
+
* )
|
|
1028
|
+
*
|
|
1029
|
+
* const employee2: Employee = { company: { address: { street: {} } } }
|
|
1030
|
+
*
|
|
1031
|
+
* assert.deepStrictEqual(
|
|
1032
|
+
* pipe(
|
|
1033
|
+
* fromNullable(employee2.company),
|
|
1034
|
+
* chainNullableK(company => company.address),
|
|
1035
|
+
* chainNullableK(address => address.street),
|
|
1036
|
+
* chainNullableK(street => street.name)
|
|
1037
|
+
* ),
|
|
1038
|
+
* none
|
|
1039
|
+
* )
|
|
1040
|
+
*
|
|
1041
|
+
* @category interop
|
|
1042
|
+
* @since 2.9.0
|
|
1043
|
+
*/
|
|
1044
|
+
var chainNullableK = function (f) { return function (ma) {
|
|
1045
|
+
return (0, exports.isNone)(ma) ? exports.none : (0, exports.fromNullable)(f(ma.value));
|
|
1046
|
+
}; };
|
|
1047
|
+
exports.chainNullableK = chainNullableK;
|
|
1048
|
+
/**
|
|
1049
|
+
* Extracts the value out of the structure, if it exists. Otherwise returns `null`.
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* import { some, none, toNullable } from 'fp-ts/Option'
|
|
1053
|
+
* import { pipe } from 'fp-ts/function'
|
|
1054
|
+
*
|
|
1055
|
+
* assert.strictEqual(
|
|
1056
|
+
* pipe(
|
|
1057
|
+
* some(1),
|
|
1058
|
+
* toNullable
|
|
1059
|
+
* ),
|
|
1060
|
+
* 1
|
|
1061
|
+
* )
|
|
1062
|
+
* assert.strictEqual(
|
|
1063
|
+
* pipe(
|
|
1064
|
+
* none,
|
|
1065
|
+
* toNullable
|
|
1066
|
+
* ),
|
|
1067
|
+
* null
|
|
1068
|
+
* )
|
|
1069
|
+
*
|
|
1070
|
+
* @category interop
|
|
1071
|
+
* @since 2.0.0
|
|
1072
|
+
*/
|
|
1073
|
+
exports.toNullable = (0, exports.match)(_function.constNull, _function.identity);
|
|
1074
|
+
/**
|
|
1075
|
+
* Extracts the value out of the structure, if it exists. Otherwise returns `undefined`.
|
|
1076
|
+
*
|
|
1077
|
+
* @example
|
|
1078
|
+
* import { some, none, toUndefined } from 'fp-ts/Option'
|
|
1079
|
+
* import { pipe } from 'fp-ts/function'
|
|
1080
|
+
*
|
|
1081
|
+
* assert.strictEqual(
|
|
1082
|
+
* pipe(
|
|
1083
|
+
* some(1),
|
|
1084
|
+
* toUndefined
|
|
1085
|
+
* ),
|
|
1086
|
+
* 1
|
|
1087
|
+
* )
|
|
1088
|
+
* assert.strictEqual(
|
|
1089
|
+
* pipe(
|
|
1090
|
+
* none,
|
|
1091
|
+
* toUndefined
|
|
1092
|
+
* ),
|
|
1093
|
+
* undefined
|
|
1094
|
+
* )
|
|
1095
|
+
*
|
|
1096
|
+
* @category interop
|
|
1097
|
+
* @since 2.0.0
|
|
1098
|
+
*/
|
|
1099
|
+
exports.toUndefined = (0, exports.match)(_function.constUndefined, _function.identity);
|
|
1100
|
+
function elem(E) {
|
|
1101
|
+
return function (a, ma) {
|
|
1102
|
+
if (ma === undefined) {
|
|
1103
|
+
var elemE_1 = elem(E);
|
|
1104
|
+
return function (ma) { return elemE_1(a, ma); };
|
|
1105
|
+
}
|
|
1106
|
+
return (0, exports.isNone)(ma) ? false : E.equals(a, ma.value);
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
exports.elem = elem;
|
|
1110
|
+
/**
|
|
1111
|
+
* Returns `true` if the predicate is satisfied by the wrapped value
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* import { some, none, exists } from 'fp-ts/Option'
|
|
1115
|
+
* import { pipe } from 'fp-ts/function'
|
|
1116
|
+
*
|
|
1117
|
+
* assert.strictEqual(
|
|
1118
|
+
* pipe(
|
|
1119
|
+
* some(1),
|
|
1120
|
+
* exists(n => n > 0)
|
|
1121
|
+
* ),
|
|
1122
|
+
* true
|
|
1123
|
+
* )
|
|
1124
|
+
* assert.strictEqual(
|
|
1125
|
+
* pipe(
|
|
1126
|
+
* some(1),
|
|
1127
|
+
* exists(n => n > 1)
|
|
1128
|
+
* ),
|
|
1129
|
+
* false
|
|
1130
|
+
* )
|
|
1131
|
+
* assert.strictEqual(
|
|
1132
|
+
* pipe(
|
|
1133
|
+
* none,
|
|
1134
|
+
* exists(n => n > 0)
|
|
1135
|
+
* ),
|
|
1136
|
+
* false
|
|
1137
|
+
* )
|
|
1138
|
+
*
|
|
1139
|
+
* @since 2.0.0
|
|
1140
|
+
*/
|
|
1141
|
+
var exists = function (predicate) { return function (ma) {
|
|
1142
|
+
return (0, exports.isNone)(ma) ? false : predicate(ma.value);
|
|
1143
|
+
}; };
|
|
1144
|
+
exports.exists = exists;
|
|
1145
|
+
// -------------------------------------------------------------------------------------
|
|
1146
|
+
// do notation
|
|
1147
|
+
// -------------------------------------------------------------------------------------
|
|
1148
|
+
/**
|
|
1149
|
+
* @since 2.9.0
|
|
1150
|
+
*/
|
|
1151
|
+
exports.Do = (0, exports.of)(_.emptyRecord);
|
|
1152
|
+
/**
|
|
1153
|
+
* @since 2.8.0
|
|
1154
|
+
*/
|
|
1155
|
+
exports.bindTo = (0, Functor.bindTo)(exports.Functor);
|
|
1156
|
+
/**
|
|
1157
|
+
* @since 2.8.0
|
|
1158
|
+
*/
|
|
1159
|
+
exports.bind = (0, Chain.bind)(exports.Chain);
|
|
1160
|
+
// -------------------------------------------------------------------------------------
|
|
1161
|
+
// pipeable sequence S
|
|
1162
|
+
// -------------------------------------------------------------------------------------
|
|
1163
|
+
/**
|
|
1164
|
+
* @since 2.8.0
|
|
1165
|
+
*/
|
|
1166
|
+
exports.apS = (0, Apply.apS)(exports.Apply);
|
|
1167
|
+
// -------------------------------------------------------------------------------------
|
|
1168
|
+
// sequence T
|
|
1169
|
+
// -------------------------------------------------------------------------------------
|
|
1170
|
+
/**
|
|
1171
|
+
* @since 2.11.0
|
|
1172
|
+
*/
|
|
1173
|
+
exports.ApT = (0, exports.of)(_.emptyReadonlyArray);
|
|
1174
|
+
// -------------------------------------------------------------------------------------
|
|
1175
|
+
// array utils
|
|
1176
|
+
// -------------------------------------------------------------------------------------
|
|
1177
|
+
/**
|
|
1178
|
+
* Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.
|
|
1179
|
+
*
|
|
1180
|
+
* @since 2.11.0
|
|
1181
|
+
*/
|
|
1182
|
+
var traverseReadonlyNonEmptyArrayWithIndex = function (f) { return function (as) {
|
|
1183
|
+
var o = f(0, _.head(as));
|
|
1184
|
+
if ((0, exports.isNone)(o)) {
|
|
1185
|
+
return exports.none;
|
|
1186
|
+
}
|
|
1187
|
+
var out = [o.value];
|
|
1188
|
+
for (var i = 1; i < as.length; i++) {
|
|
1189
|
+
var o_1 = f(i, as[i]);
|
|
1190
|
+
if ((0, exports.isNone)(o_1)) {
|
|
1191
|
+
return exports.none;
|
|
1192
|
+
}
|
|
1193
|
+
out.push(o_1.value);
|
|
1194
|
+
}
|
|
1195
|
+
return (0, exports.some)(out);
|
|
1196
|
+
}; };
|
|
1197
|
+
exports.traverseReadonlyNonEmptyArrayWithIndex = traverseReadonlyNonEmptyArrayWithIndex;
|
|
1198
|
+
/**
|
|
1199
|
+
* Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.
|
|
1200
|
+
*
|
|
1201
|
+
* @since 2.11.0
|
|
1202
|
+
*/
|
|
1203
|
+
var traverseReadonlyArrayWithIndex = function (f) {
|
|
1204
|
+
var g = (0, exports.traverseReadonlyNonEmptyArrayWithIndex)(f);
|
|
1205
|
+
return function (as) { return (_.isNonEmpty(as) ? g(as) : exports.ApT); };
|
|
1206
|
+
};
|
|
1207
|
+
exports.traverseReadonlyArrayWithIndex = traverseReadonlyArrayWithIndex;
|
|
1208
|
+
/**
|
|
1209
|
+
* @since 2.9.0
|
|
1210
|
+
*/
|
|
1211
|
+
exports.traverseArrayWithIndex = exports.traverseReadonlyArrayWithIndex;
|
|
1212
|
+
/**
|
|
1213
|
+
* @since 2.9.0
|
|
1214
|
+
*/
|
|
1215
|
+
var traverseArray = function (f) {
|
|
1216
|
+
return (0, exports.traverseReadonlyArrayWithIndex)(function (_, a) { return f(a); });
|
|
1217
|
+
};
|
|
1218
|
+
exports.traverseArray = traverseArray;
|
|
1219
|
+
/**
|
|
1220
|
+
* @since 2.9.0
|
|
1221
|
+
*/
|
|
1222
|
+
exports.sequenceArray = (0, exports.traverseArray)(_function.identity);
|
|
1223
|
+
// -------------------------------------------------------------------------------------
|
|
1224
|
+
// deprecated
|
|
1225
|
+
// -------------------------------------------------------------------------------------
|
|
1226
|
+
/**
|
|
1227
|
+
* Use `Refinement` module instead.
|
|
1228
|
+
*
|
|
1229
|
+
* @since 2.0.0
|
|
1230
|
+
* @deprecated
|
|
1231
|
+
*/
|
|
1232
|
+
function getRefinement(getOption) {
|
|
1233
|
+
return function (a) { return (0, exports.isSome)(getOption(a)); };
|
|
1234
|
+
}
|
|
1235
|
+
exports.getRefinement = getRefinement;
|
|
1236
|
+
/**
|
|
1237
|
+
* Use [`chainNullableK`](#chainnullablek) instead.
|
|
1238
|
+
*
|
|
1239
|
+
* @category combinators
|
|
1240
|
+
* @since 2.0.0
|
|
1241
|
+
* @deprecated
|
|
1242
|
+
*/
|
|
1243
|
+
exports.mapNullable = exports.chainNullableK;
|
|
1244
|
+
/**
|
|
1245
|
+
* This instance is deprecated, use small, specific instances instead.
|
|
1246
|
+
* For example if a function needs a `Functor` instance, pass `O.Functor` instead of `O.option`
|
|
1247
|
+
* (where `O` is from `import O from 'fp-ts/Option'`)
|
|
1248
|
+
*
|
|
1249
|
+
* @category instances
|
|
1250
|
+
* @since 2.0.0
|
|
1251
|
+
* @deprecated
|
|
1252
|
+
*/
|
|
1253
|
+
exports.option = {
|
|
1254
|
+
URI: exports.URI,
|
|
1255
|
+
map: _map,
|
|
1256
|
+
of: exports.of,
|
|
1257
|
+
ap: _ap,
|
|
1258
|
+
chain: _chain,
|
|
1259
|
+
reduce: _reduce,
|
|
1260
|
+
foldMap: _foldMap,
|
|
1261
|
+
reduceRight: _reduceRight,
|
|
1262
|
+
traverse: _traverse,
|
|
1263
|
+
sequence: exports.sequence,
|
|
1264
|
+
zero: exports.zero,
|
|
1265
|
+
alt: _alt,
|
|
1266
|
+
extend: _extend,
|
|
1267
|
+
compact: exports.compact,
|
|
1268
|
+
separate: exports.separate,
|
|
1269
|
+
filter: _filter,
|
|
1270
|
+
filterMap: _filterMap,
|
|
1271
|
+
partition: _partition,
|
|
1272
|
+
partitionMap: _partitionMap,
|
|
1273
|
+
wither: _wither,
|
|
1274
|
+
wilt: _wilt,
|
|
1275
|
+
throwError: exports.throwError
|
|
1276
|
+
};
|
|
1277
|
+
/**
|
|
1278
|
+
* Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.
|
|
1279
|
+
*
|
|
1280
|
+
* @category instances
|
|
1281
|
+
* @since 2.0.0
|
|
1282
|
+
* @deprecated
|
|
1283
|
+
*/
|
|
1284
|
+
exports.getApplySemigroup = (0, Apply.getApplySemigroup)(exports.Apply);
|
|
1285
|
+
/**
|
|
1286
|
+
* Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.
|
|
1287
|
+
*
|
|
1288
|
+
* @category instances
|
|
1289
|
+
* @since 2.0.0
|
|
1290
|
+
* @deprecated
|
|
1291
|
+
*/
|
|
1292
|
+
exports.getApplyMonoid = (0, Applicative.getApplicativeMonoid)(exports.Applicative);
|
|
1293
|
+
/**
|
|
1294
|
+
* Use
|
|
1295
|
+
*
|
|
1296
|
+
* ```ts
|
|
1297
|
+
* import { first } from 'fp-ts/Semigroup'
|
|
1298
|
+
* import { getMonoid } from 'fp-ts/Option'
|
|
1299
|
+
*
|
|
1300
|
+
* getMonoid(first())
|
|
1301
|
+
* ```
|
|
1302
|
+
*
|
|
1303
|
+
* instead.
|
|
1304
|
+
*
|
|
1305
|
+
* Monoid returning the left-most non-`None` value
|
|
1306
|
+
*
|
|
1307
|
+
* | x | y | concat(x, y) |
|
|
1308
|
+
* | ------- | ------- | ------------ |
|
|
1309
|
+
* | none | none | none |
|
|
1310
|
+
* | some(a) | none | some(a) |
|
|
1311
|
+
* | none | some(b) | some(b) |
|
|
1312
|
+
* | some(a) | some(b) | some(a) |
|
|
1313
|
+
*
|
|
1314
|
+
* @example
|
|
1315
|
+
* import { getFirstMonoid, some, none } from 'fp-ts/Option'
|
|
1316
|
+
*
|
|
1317
|
+
* const M = getFirstMonoid<number>()
|
|
1318
|
+
* assert.deepStrictEqual(M.concat(none, none), none)
|
|
1319
|
+
* assert.deepStrictEqual(M.concat(some(1), none), some(1))
|
|
1320
|
+
* assert.deepStrictEqual(M.concat(none, some(2)), some(2))
|
|
1321
|
+
* assert.deepStrictEqual(M.concat(some(1), some(2)), some(1))
|
|
1322
|
+
*
|
|
1323
|
+
* @category instances
|
|
1324
|
+
* @since 2.0.0
|
|
1325
|
+
* @deprecated
|
|
1326
|
+
*/
|
|
1327
|
+
var getFirstMonoid = function () { return (0, exports.getMonoid)((0, Semigroup.first)()); };
|
|
1328
|
+
exports.getFirstMonoid = getFirstMonoid;
|
|
1329
|
+
/**
|
|
1330
|
+
* Use
|
|
1331
|
+
*
|
|
1332
|
+
* ```ts
|
|
1333
|
+
* import { last } from 'fp-ts/Semigroup'
|
|
1334
|
+
* import { getMonoid } from 'fp-ts/Option'
|
|
1335
|
+
*
|
|
1336
|
+
* getMonoid(last())
|
|
1337
|
+
* ```
|
|
1338
|
+
*
|
|
1339
|
+
* instead.
|
|
1340
|
+
*
|
|
1341
|
+
* Monoid returning the right-most non-`None` value
|
|
1342
|
+
*
|
|
1343
|
+
* | x | y | concat(x, y) |
|
|
1344
|
+
* | ------- | ------- | ------------ |
|
|
1345
|
+
* | none | none | none |
|
|
1346
|
+
* | some(a) | none | some(a) |
|
|
1347
|
+
* | none | some(b) | some(b) |
|
|
1348
|
+
* | some(a) | some(b) | some(b) |
|
|
1349
|
+
*
|
|
1350
|
+
* @example
|
|
1351
|
+
* import { getLastMonoid, some, none } from 'fp-ts/Option'
|
|
1352
|
+
*
|
|
1353
|
+
* const M = getLastMonoid<number>()
|
|
1354
|
+
* assert.deepStrictEqual(M.concat(none, none), none)
|
|
1355
|
+
* assert.deepStrictEqual(M.concat(some(1), none), some(1))
|
|
1356
|
+
* assert.deepStrictEqual(M.concat(none, some(2)), some(2))
|
|
1357
|
+
* assert.deepStrictEqual(M.concat(some(1), some(2)), some(2))
|
|
1358
|
+
*
|
|
1359
|
+
* @category instances
|
|
1360
|
+
* @since 2.0.0
|
|
1361
|
+
* @deprecated
|
|
1362
|
+
*/
|
|
1363
|
+
var getLastMonoid = function () { return (0, exports.getMonoid)((0, Semigroup.last)()); };
|
|
1364
|
+
exports.getLastMonoid = getLastMonoid;
|
|
1365
|
+
});
|
|
1366
|
+
|
|
1367
|
+
const Option$1 = /*@__PURE__*/getDefaultExportFromCjs(Option);
|
|
1368
|
+
|
|
1369
|
+
const sequenceToOption = Apply.sequenceT(Option.Apply);
|
|
1370
|
+
const checkEmpryString = (x) => x.length > 0 ? Option.some(x) : Option.none;
|
|
1371
|
+
|
|
1372
|
+
// -------------------------------------------------------------------------------------
|
|
1373
|
+
// refinements
|
|
1374
|
+
// -------------------------------------------------------------------------------------
|
|
1375
|
+
/**
|
|
1376
|
+
* @category refinements
|
|
1377
|
+
* @since 2.11.0
|
|
1378
|
+
*/
|
|
1379
|
+
var isNumber = function (u) { return typeof u === 'number'; };
|
|
1380
|
+
// -------------------------------------------------------------------------------------
|
|
1381
|
+
// instances
|
|
1382
|
+
// -------------------------------------------------------------------------------------
|
|
1383
|
+
/**
|
|
1384
|
+
* @category instances
|
|
1385
|
+
* @since 2.10.0
|
|
1386
|
+
*/
|
|
1387
|
+
var Eq = {
|
|
1388
|
+
equals: function (first, second) { return first === second; }
|
|
1389
|
+
};
|
|
1390
|
+
/**
|
|
1391
|
+
* @category instances
|
|
1392
|
+
* @since 2.10.0
|
|
1393
|
+
*/
|
|
1394
|
+
var Ord = {
|
|
1395
|
+
equals: Eq.equals,
|
|
1396
|
+
compare: function (first, second) { return (first < second ? -1 : first > second ? 1 : 0); }
|
|
1397
|
+
};
|
|
1398
|
+
/**
|
|
1399
|
+
* @category instances
|
|
1400
|
+
* @since 2.10.0
|
|
1401
|
+
*/
|
|
1402
|
+
var Bounded = {
|
|
1403
|
+
equals: Eq.equals,
|
|
1404
|
+
compare: Ord.compare,
|
|
1405
|
+
top: Infinity,
|
|
1406
|
+
bottom: -Infinity
|
|
1407
|
+
};
|
|
1408
|
+
/**
|
|
1409
|
+
* @category instances
|
|
1410
|
+
* @since 2.10.0
|
|
1411
|
+
*/
|
|
1412
|
+
var Show = {
|
|
1413
|
+
show: function (n) { return JSON.stringify(n); }
|
|
1414
|
+
};
|
|
1415
|
+
/**
|
|
1416
|
+
* @category instances
|
|
1417
|
+
* @since 2.11.0
|
|
1418
|
+
*/
|
|
1419
|
+
var MagmaSub = {
|
|
1420
|
+
concat: function (first, second) { return first - second; }
|
|
1421
|
+
};
|
|
1422
|
+
/**
|
|
1423
|
+
* `number` semigroup under addition.
|
|
1424
|
+
*
|
|
1425
|
+
* @example
|
|
1426
|
+
* import { SemigroupSum } from 'fp-ts/number'
|
|
1427
|
+
*
|
|
1428
|
+
* assert.deepStrictEqual(SemigroupSum.concat(2, 3), 5)
|
|
1429
|
+
*
|
|
1430
|
+
* @category instances
|
|
1431
|
+
* @since 2.10.0
|
|
1432
|
+
*/
|
|
1433
|
+
var SemigroupSum = {
|
|
1434
|
+
concat: function (first, second) { return first + second; }
|
|
1435
|
+
};
|
|
1436
|
+
/**
|
|
1437
|
+
* `number` semigroup under multiplication.
|
|
1438
|
+
*
|
|
1439
|
+
* @example
|
|
1440
|
+
* import { SemigroupProduct } from 'fp-ts/number'
|
|
1441
|
+
*
|
|
1442
|
+
* assert.deepStrictEqual(SemigroupProduct.concat(2, 3), 6)
|
|
1443
|
+
*
|
|
1444
|
+
* @category instances
|
|
1445
|
+
* @since 2.10.0
|
|
1446
|
+
*/
|
|
1447
|
+
var SemigroupProduct = {
|
|
1448
|
+
concat: function (first, second) { return first * second; }
|
|
1449
|
+
};
|
|
1450
|
+
/**
|
|
1451
|
+
* `number` monoid under addition.
|
|
1452
|
+
*
|
|
1453
|
+
* The `empty` value is `0`.
|
|
1454
|
+
*
|
|
1455
|
+
* @example
|
|
1456
|
+
* import { MonoidSum } from 'fp-ts/number'
|
|
1457
|
+
*
|
|
1458
|
+
* assert.deepStrictEqual(MonoidSum.concat(2, MonoidSum.empty), 2)
|
|
1459
|
+
*
|
|
1460
|
+
* @category instances
|
|
1461
|
+
* @since 2.10.0
|
|
1462
|
+
*/
|
|
1463
|
+
var MonoidSum = {
|
|
1464
|
+
concat: SemigroupSum.concat,
|
|
1465
|
+
empty: 0
|
|
1466
|
+
};
|
|
1467
|
+
/**
|
|
1468
|
+
* `number` monoid under multiplication.
|
|
1469
|
+
*
|
|
1470
|
+
* The `empty` value is `1`.
|
|
1471
|
+
*
|
|
1472
|
+
* @example
|
|
1473
|
+
* import { MonoidProduct } from 'fp-ts/number'
|
|
1474
|
+
*
|
|
1475
|
+
* assert.deepStrictEqual(MonoidProduct.concat(2, MonoidProduct.empty), 2)
|
|
1476
|
+
*
|
|
1477
|
+
* @category instances
|
|
1478
|
+
* @since 2.10.0
|
|
1479
|
+
*/
|
|
1480
|
+
var MonoidProduct = {
|
|
1481
|
+
concat: SemigroupProduct.concat,
|
|
1482
|
+
empty: 1
|
|
1483
|
+
};
|
|
1484
|
+
/**
|
|
1485
|
+
* @category instances
|
|
1486
|
+
* @since 2.10.0
|
|
1487
|
+
*/
|
|
1488
|
+
var Field = {
|
|
1489
|
+
add: SemigroupSum.concat,
|
|
1490
|
+
zero: 0,
|
|
1491
|
+
mul: SemigroupProduct.concat,
|
|
1492
|
+
one: 1,
|
|
1493
|
+
sub: MagmaSub.concat,
|
|
1494
|
+
degree: function (_) { return 1; },
|
|
1495
|
+
div: function (first, second) { return first / second; },
|
|
1496
|
+
mod: function (first, second) { return first % second; }
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1499
|
+
export { Applicative as A, Option as O, Predicate as P, Ord as a, checkEmpryString as c, sequenceToOption as s };
|