• Stars
    star
    172
  • Rank 219,922 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 10 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Options, Tries, and Futures for JavaScript / TypeScript

Monapt

npm version Build Status Coverage Status

semantic-release Commitizen friendly Conventional Commits

Monapt helps you better manage null, undefined, exceptions, and other mildly interesting phenomena. It handles them through the Option, Try, and Future abstractions.

Setup

$ npm install monapt

APIs

Usage

import { Option } from 'monapt';

Option(1)
  .map((x) => x * 2)
  .getOrElse(() => 4);

Docs are undergoing a redesign, and will be published on a separate site. In the meantime, the sources for the Option, Future, and Try classes are readable.

You can also take a look at the tests to get a feel for how to use them.

Changes in 1.0

1.0 was a complete rewrite of Monapt - including everything from the implementation to the tooling to the tests. The result is almost the same API, but more true to the original Scala interface.

Migrating from 0.7.1

Breaking Changes

  • All default exports have been removed to avoid ambiguity.
  • Future now depends on native ES6 Promises, and uses them internally when representing promises. Make sure to include a shim if you plan on using Futures.
  • Future#onFailure has been removed.
  • Future#onSuccess has been removed.
  • Future#reject has been removed.
  • Monapt::flatten has been renamed to Option::flatten.
  • Monapt::future has been renamed to Future::create. It now accepts a when.Promise<A> | when.Thenable<A> | A.
  • Option#reject has been renamed to Option#filterNot.
  • Try#reject has been removed.

These are all backed by type definitions, so compiling your code via TypeScript should reveal any breakages.

Credits

This repo couldn't have been possible without yaakaito/monapt. In his absence, I'll continue improving upon his hard work.

More Repositories

1

manga_downloader

Cross-platform, multi-site, multi-threaded manga downloader with over 5000 distinct mangas. Includes support for automated downloading via external .xml file and conversion for viewing on the Kindle.
Python
266
star
2

git-workflow-strategies-example

Folding a feature branch into master, using merge --no-ff, rebase, and squash.
63
star
3

mangopi

A manga API with a pluggable site architecture.
Python
27
star
4

rematch

Pattern matching for JavaScript / TypeScript
JavaScript
18
star
5

jstile

A JavaScript tiling manager.
CoffeeScript
2
star
6

neonews

A web portal to newsgroup servers built on an SQLite database, Django framework, and new HTML5 features; an overhaul of html4nntp.
Python
2
star
7

promise-as3

Temporary repo to hold old promise-as3 fork - https://github.com/pmowrer/promise-as3
ActionScript
1
star
8

neptune

An all-in-one package to "clean up" a music folder, i.e. grab album art, lyrics, organize into folders based on album/artist, remove duplicates, etc...maybe even autotag in the future?
Python
1
star
9

nntplib4py2

A backport of the Python v3.2 nntplib module to Python v2.x, allowing for SSL. Currently tested on v2.6.5+.
Python
1
star
10

music_apis

Python library that can talk to API/music services such as last.fm, pandora, etc.
Python
1
star
11

eduwrite

Real-time collaborative learning based on Etherpad-lite.
JavaScript
1
star
12

BBV

Reputation management in p2p storage using virtual currency exchange.
Scala
1
star
13

genesis

Want to build an app with Vue, Webpack, and TypeScript? Don't waste time scaffolding.
TypeScript
1
star
14

python-boilerplate

Just add water!
Python
1
star
15

aethyr

A (slightly-more-than) proof-of-concept man-in-the-middle attack on iTunes.
Python
1
star