@sullux/fp-light-always
v0.0.1
Published
A lightweight functional library for functional composition and object composition.
Downloads
6
Readme
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)))