Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/code0wl/basin.js
💧A chain-able pipe helper for primitive datatypes
https://github.com/code0wl/basin.js
Last synced: about 1 month ago
JSON representation
💧A chain-able pipe helper for primitive datatypes
- Host: GitHub
- URL: https://github.com/code0wl/basin.js
- Owner: code0wl
- Created: 2018-05-09T04:20:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-11T01:08:10.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T07:23:47.842Z (10 months ago)
- Language: TypeScript
- Homepage:
- Size: 570 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Basin.js 💧
A small utility function for chaining non-array datatype operators. Works the same as map does in it's compositional state.
Main focus is the capture assignment in a linear workflow.### Simple Example
```Javascript
const calculateTotal = initial =>
Basin(initial)
.tap(s => s * .21) // add tax
.tap(s => s + 12) // shipping costs
.drop(total => initial + total)const result = calculateTotal(100) //? 133
```### API
Api consists of chaining the Basin function with your input. The last input of your basin can be a drop. Which means the last drop from the tap. Drop does not really have to be used.
### Note
Performance isn't an issue unless you are benchmarking in the 10,000+ operations.