Miss any of our Open RFC calls?Watch the recordings here! »

This package has been deprecated

Author message:

"@vitorluizc/maybe" is deprecated. It was renamed and moved to "@bitty" scoped packages. Now it should be installed as "@bitty/maybe".

@vitorluizc/maybe

2.0.0 • Public • Published

@vitorluizc/maybe

Build Status License Library minified size Library minified + gzipped size

Maybe wraps unsafe values and provide methods to handle them in a safe flow.

Usage

import { createMaybe } from '@vitorluizc/maybe'
 
const repositories =
  createMaybe(field.value)
    .map(name => users.find(user => user.name.includes(name)))
    .map(user => repositories.filter(repository => repository.owner === user.id))
 
repositories.get([]).forEach(repository => {
  container.innerHTML += renderRepository(repository);
})

Installation

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

npm install @vitorluizc/maybe --save
 
# For Yarn, use the command below. 
yarn add @vitorluizc/maybe

Installation from CDN

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

<script src="https://unpkg.com/@vitorluizc/maybe@^2.0.0"></script>
 
<script>
  // jQuery is here just to show the example.
 
  $("#field-name").on("change", event => {
    Maybe.createMaybe(event.target.value)
      .map(name => users.filterByName(name))
      .map(users => $("#template-users").render(users));
  });
</script> 

Documentation

Documentation generated from source files by Typedoc.

License

Released under MIT License.

Install

npm i @vitorluizc/maybe

DownloadsWeekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

30.8 kB

Total Files

10

Last publish

Collaborators

  • avatar