@rpearce/ts-fns

:warning: This repo & package are for experimentation with typescript and functions. Use at your own risk.

Usage no npm install needed!

<script type="module">
  import rpearceTsFns from 'https://cdn.skypack.dev/@rpearce/ts-fns';
</script>

README

@rpearce/ts-fns

npm version npm downloads bundlephobia size

:warning: This repo & package are for experimentation with typescript and functions. Use at your own risk.

Special thanks to the following for helping with some typings!

Example usage

npm i @rpearce/ts-fns
import { lift2, propOr } from '@rpearce/ts-fns'

const propOrNA      = propOr('N/A')
const getName       = propOrNA('name')
const getEmail      = propOrNA('email')
const joinPipe      = (x: string) => (y: string) => `${x} | ${y}`
const joinNameEmail = lift2(joinPipe)(getName)(getEmail)
const input         = { name: 'bobert', email: 'bobert@email.com', foo: 'bar' }

console.log(joinNameEmail(input))
// 'bobert | bobert@email.com'

Typed functions