@pauliojanpera/pipe-operator
TypeScript icon, indicating that this package has built-in type declarations

0.0.22 • Public • Published

Pipe operator

A pipelining operator to allow postfix syntax for function invocation in the absence of a real pipelining operator.

Installation and Usage

pnpm i @pauliojanpera/pipe-operator
import { pipeOperator as to } from '@pauliojanpera/pipe-operator';

// f(f(2)) == 8
const f = (v: Number): number => v.valueOf() * 2;
console.log((2)[to](f)[to](f)); // '8'

// g([1,2,3]) == '1-2-3'
const g = (numbers: number[]): string => numbers.join('-');
console.log([1, 2, 3][to](g)); // '1-2-3'

Building/Testing

  • pnpm i -g verdaccio install the Verdaccio package registry proxy
  • pnpm dev run Verdaccio
  • pnpm build build and publish in Verdaccio locally
  • pnpm t run tests
  • pnpm pub publish ./dist

Package Sidebar

Install

npm i @pauliojanpera/pipe-operator

Weekly Downloads

127

Version

0.0.22

License

MIT

Unpacked Size

7.11 kB

Total Files

10

Last publish

Collaborators

  • pauliojanpera