profound
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

profound

Profound is a compostion / flow / pipe library written for typescript.

It allows for code to be written like this:

import { placeholder, profound } from '@reggi/profound'

const age = placeholder<number>()('age')

const alpha = profound({}, ({ }) => 'hello world I\'m a profound')
// console.log(alpha()) // hello world I\'m a profound

const beta = profound({ alpha }, ({ alpha }) => `I am using alpha as a dependency (${alpha})`)
// console.log(beta()) // I am using alpha as a dependency (hello world I'm a profound)

const gamma = profound({ alpha, beta }, ({ alpha, beta }) => `
    Gamma needs alpha and beta to run.
    Rather then being very redundent and running both in here. They are fetched for use. 
    If you pass alpha or beta into gamma, they are not run. 
    This function also takes any arguments that alpha, or beta need.
    Profounds become async: 
        1. If their dependencies are async and are being run (input dependent)
        2. If this callback is async
    (${alpha} ${beta})
`)

const delta = profound({ age, gamma }, ({ age, gamma }) => gamma.length + age)

console.log(delta({ age: 30 })) // 514

Readme

Keywords

none

Package Sidebar

Install

npm i profound

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

11.9 kB

Total Files

4

Last publish

Collaborators

  • reggi