https://github.com/csvenke/pipe
Pipe implementation with (almost) variadic kinds
https://github.com/csvenke/pipe
composition javascript library npm-package pipe typescript
Last synced: 5 months ago
JSON representation
Pipe implementation with (almost) variadic kinds
- Host: GitHub
- URL: https://github.com/csvenke/pipe
- Owner: csvenke
- License: mit
- Archived: true
- Created: 2020-04-17T11:03:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-01T18:10:20.000Z (about 1 year ago)
- Last Synced: 2024-10-27T21:10:58.072Z (9 months ago)
- Topics: composition, javascript, library, npm-package, pipe, typescript
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@csvenke/pipe
- Size: 553 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
@csvenke/pipe
Pipe implementation with (almost) variadic kinds
Install •
Usage •
Development •
Credits •
License## Install
Using npm
```
npm install --save @csvenke/pipe
```Using yarn
```
yarn add @csvenke/pipe
```## Usage
With javascript
```js
import pipe from "@csvenke/pipe";const getName = data => data.name;
const toUpperCase = str => str.toUpperCase();
const reverse = str => str.split("").reverse().join("");
const piped = pipe(getName, toUpperCase, reverse);
console.log(piped({ name: "John" })); // NHOJ
```With typescript
```ts
import pipe from "@csvenke/pipe";interface Data {
name: string;
}const getName = (data: Data) => data.name;
const toUpperCase = (str: string) => str.toUpperCase();
const reverse = (str: string) => str.split("").reverse().join("");
const piped = pipe(getName, toUpperCase, reverse);
console.log(piped({ name: "John" })); // NHOJ
```## Development
Installing dependencies
```
yarn install
```Running tests
```
yarn test
```## Credits
- This wouldn't have been possible without [jcalz](https://stackoverflow.com/questions/53173203/typescript-recursive-function-composition) amazing stack overflow answer!
## License
MIT