/option-value

Primary LanguageTypeScriptMIT LicenseMIT

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)
}