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

0.2.6 • Public • Published

Tests npm (scoped) License

Pipe is a library for handle values, It completes the validate and conversion of values by combining handler functions.

Pipe 是一个处理值的库,它通过组合处理函数来完成对值的验证和转换。

import { pipe, int, min, max } from '@unicreators/pipe';

let fn = pipe(int(), min(2), max(10));
console.log(fn(8) == 8);
// true
console.log(fn(1) === undefined);
// true

fn = pipe(int({tryConvert: true}), min(2), max(10));
console.log(fn('8') == 8);
// true

🍉 APIs & Example

Install

$ npm install @unicreators/pipe

Handlers

Composers

License

MIT

Package Sidebar

Install

npm i @unicreators/pipe

Weekly Downloads

1

Version

0.2.6

License

MIT

Unpacked Size

140 kB

Total Files

20

Last publish

Collaborators

  • unicreators