1.1.7 • Published 3 years ago

@xroom.app/data-types v1.1.7

Weekly downloads
134
License
MIT
Repository
github
Last release
3 years ago

Useful data types written in javascript

Installation

Run from command line

npm i @xroom.app/data-types

Usage example

const E = require('@xroom.app/data-types/lib/either')

/** @type {(x: number) => (y: number) => number} */
const add = x => y => x + y

/** @type {<T>(data: T) => E.Either<string, T>} */
const checkNotZero = data => data !== 0 ? E.right(data) : E.left('zero')

const unsafeData = Math.round(Math.random())

const result = E.map(checkNotZero(unsafeData), add(10))

// Will log the message if unsafeData = 1 or throw an error if unsafeData = 0
console.log(`unsafeData + 10 = ${E.extractUnsafe(result)}`)
1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago