Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonathanconway/ts-pipeline
A simple type-safe pipeline function.
https://github.com/jonathanconway/ts-pipeline
Last synced: 15 days ago
JSON representation
A simple type-safe pipeline function.
- Host: GitHub
- URL: https://github.com/jonathanconway/ts-pipeline
- Owner: jonathanconway
- License: mit
- Created: 2019-03-03T12:47:55.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-03T12:52:24.000Z (almost 6 years ago)
- Last Synced: 2024-12-30T06:38:01.327Z (26 days ago)
- Language: TypeScript
- Homepage:
- Size: 58.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ts-pipeline
In lieu of an official ES6 / Typescript pipe operator, here's my own simple, home-baked solution.
## Example
```ts
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"
```