@sullux/fp-light-always

0.0.1 • Public • Published

home

fp-light-always

npm i @sullux/fp-light-always source test

The always utility wraps a static value in a function. While simple as far as utilities go, it can add readability to functional code.

always

always<T>(value: T): T

The following example uses always to return a pre-determined value from a thennable.

const { curry } = require('@sullux/fp-light-curry')
const AWS = require('aws-sdk')

const s3 = new AWS.s3()

const saveObject = curry((key, object) =>
  s3.putObject({
    Body: JSON.stringify(object),
    Bucket: process.env.BUCKET,
    Key: key,
  }).promise().then(always(object)))

Readme

Keywords

Package Sidebar

Install

npm i @sullux/fp-light-always

Weekly Downloads

4

Version

0.0.1

License

MIT

Unpacked Size

1.46 kB

Total Files

3

Last publish

Collaborators

  • sullux