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

limonad

1.1.0 • Public • Published

Limonad

Limonad

Set of majestic monad and monoid functions wrapped into a strongly-typed jacket to perform state of the art functional programming with a OOP twist.

Using the module

import { Limonad } from 'limonad';

Example code

With limonads:

const isSecondWordLong = (val: string) => Limonad.maybe(val)
  .mapMaybe(e => e.split(' ')[1])
  .chain(Limonad.binary(e => e.length > 4))
  .extract()

console.log(isSecondWordLongerThan4('long sentence'))
console.log(isSecondWordLongerThan4('longword'))
console.log(isSecondWordLongerThan4(null))

Without limonads:

const isSecondWordLongerThan4 = (val: string) => {
  if (val) {
    const secondWord = val.split(' ')[1];

    if (secondWord) {
      return secondWord.length > 4;
    }
  }

  return null;
}

console.log(isSecondWordLongerThan4('long sentence'))
console.log(isSecondWordLongerThan4('longword'))
console.log(isSecondWordLongerThan4(null))

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

What things you need to install the software and how to install them

  • Node.js 10.x LTS - a JavaScript runtime built on Chrome's V8 JavaScript engine.

Installation

Install NodeJS dependencies:

$ npm i

Running the app

# watch mode (recommended for development) 
$ npm run serve

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

Nest is MIT licensed.

Install

npm i limonad

DownloadsWeekly Downloads

4

Version

1.1.0

License

ISC

Unpacked Size

307 kB

Total Files

23

Last publish

Collaborators

  • avatar