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

0.1.0 • Public • Published

ts-pipeline

In lieu of an official ES6 / Typescript pipe operator, here's my own simple, home-baked solution.

Examples

import { pipeline } from "ts-pipeline";
 
const toLowerCase = (input: string) => input.toLowerCase();
const removePunctuation = (input: string) => input.replace(/./g, "").replace(/!/g, "");
const toArray = (input: string) => input.split(" ");
const joinWithHyphen = (input: string[]) => input.join("-");
 
const input = "This... is a file name!";
const output =
  pipeline(
    input,
 
    toLowerCase,
    removePunctuation,
    toArray,
    joinWithHyphen);
 
 
console.log("Output: ", output);
// Output: "this-is-a-file-name"

Readme

Keywords

none

Package Sidebar

Install

npm i ts-pipeline

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

9.13 kB

Total Files

8

Last publish

Collaborators

  • jonathanconway