@bitty/maybe
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@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.

Package Sidebar

Install

npm i @bitty/maybe

Weekly Downloads

11

Version

0.2.0

License

MIT

Unpacked Size

50.3 kB

Total Files

31

Last publish

Collaborators

  • vitorluizc
  • bitty