@practical-fp/pipes
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

@practical-fp/pipes

A Typescript library for piping values through functions.

Installation

$ npm install @practical-fp/pipes

NPM

Examples

import {pipe} from "@practical-fp/pipes"

const result = pipe(
    5,
    number => number * 5,
    number => number.toFixed(),
    number => `The result is ${number}`,
    result => result.toUpperCase(),
)
import {asyncPipe} from "@practical-fp/pipes"

const title = await asyncPipe(
    "https://jsonplaceholder.typicode.com/todos/1",
    url => fetch(url),
    response => response.json(),
    json => json.title,
)
import {pipeR} from "@practical-fp/pipes"

const result = pipeR(
    (result: string) => result.toUpperCase(),
    (number: string) => `The result is ${number}`,
    (number: number) => number.toFixed(),
    (number: number) => number * 5,
    5,
)
import {asyncPipeR} from "@practical-fp/pipes"

const title = await asyncPipeR(
    (json: any) => json.title,
    (response: Response) => response.json(),
    (url: string) => fetch(url),
    "https://jsonplaceholder.typicode.com/todos/1",
)

Readme

Keywords

none

Package Sidebar

Install

npm i @practical-fp/pipes

Weekly Downloads

0

Version

1.1.1

License

MIT

Unpacked Size

642 kB

Total Files

10

Last publish

Collaborators

  • felixschorer