This package has been deprecated

Author message:

this version has been deprecated

nullable2

0.0.3-1 • Public • Published

nullable2

A nullable(Null safety) implementation. Inspired by Kotlin.

npm npm

Install

yarn add nullable2

Usage

Basic

Before

const item = items.findOrNull(id);
const child = item && item.getChildOrNull();
const value = child && child.values && child.values.getValue(param)

After

const nullable = require('nullable2')

const value = nullable(items, v => v
  .findOrNull(id)
  .getChildOrNull()
  .values
  .getValue(param))

Currying

const items$$ = nullable(items)

const child = items$$(v => v
  .findOrNull(id)
  .getChildOrNull())

const otherTitle = items$$(v => v
  .findOrNull(otherId)
  .title)

Related

License

MIT

/nullable2/

    Package Sidebar

    Install

    npm i nullable2

    Weekly Downloads

    4

    Version

    0.0.3-1

    License

    MIT

    Unpacked Size

    3.76 kB

    Total Files

    5

    Last publish

    Collaborators

    • skt-t1-byungi