Skip to content

🌯 The prettiest TypeScript implementation of Maybe monad.

License

Notifications You must be signed in to change notification settings

VitorLuizC/maybe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d797de8 Β· Jan 9, 2022

History

88 Commits
Sep 6, 2020
Jul 16, 2020
Jul 14, 2020
Jul 13, 2020
Sep 6, 2020
Jan 9, 2022
Nov 3, 2020
Jan 24, 2021
Jul 14, 2020

Repository files navigation

@bitty/maybe

Library minified size Library minified + gzipped size

Installation

This library is published in the NPM registry and can be installed using any compatible package manager.

npm install @bitty/maybe --save

# For Yarn, use the command below.
yarn add @bitty/maybe

Installation from CDN

This module has a UMD bundle available through JSDelivr and Unpkg CDNs.

<!-- For UNPKG use the code below. -->
<script src="https://unpkg.com/@bitty/maybe"></script>

<!-- For JSDelivr use the code below. -->
<script src="https://cdn.jsdelivr.net/npm/@bitty/maybe"></script>

<script>
  // UMD module is exposed through the "Maybe" global object.
  Maybe.fromFalsy(document.querySelector('input#id'))
    .chain((el) => Maybe.fromFalsy(el.value?.trim()))
    .map(console.log);
</script>

Examples

  • getLanguage is a function that resolves language in application. Its a pretty common case and it was implemented in the way I think we should use Maybe.

License

Released under MIT License.