OwczarekGit / option-value

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

option-value

Handle nullable values in more convenient functional way.

Links:

npm | GitHub

Example usage:

import { Maybe } from 'option-value'

function func(): string | null { ... }
function process(value: string) { ... }

// Use
Maybe(func()).ifPresent(process)

// Instead of
let maybeString: string | null = func()
if (maybeString != null) {
  process(maybeString)
}

About

License:MIT License


Languages

Language:TypeScript 100.0%