Socket
Socket
Sign inDemoInstall

@berhalak/monads

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @berhalak/monads

Typescript monads


Version published
Maintainers
1
Install size
33.3 kB
Created

Readme

Source

monads

Typescript monads


// sample usage
expect(lift(lift(5)).map(x => x + 6).value()).toBe(11);

// from constants
expect(lift(5).map(x => x + 6).value()).toBe(11);
expect(some(5).map(x => x + 6).value()).toBe(11);

// async support
expect(await wait(lift(5)).map(x => x + 6).value()).toBe(11);

// constant map
expect(await wait(5).map(x => x + 6).value()).toBe(11);
expect(await wait(5).map(x => x + 6).value()).toBe(11);

// move from normal monad to async
expect(await lift(4).map(async x => x + 5).wait().map(x=> x + 2).value()).toBe(11);

// fluent selector
expect(from([1,2]).map(x => x + 1).toArray()).toStrictEqual([2,3]);

Keywords

FAQs

Last updated on 15 Feb 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc