Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
@bitty/pipe
Advanced tools
Readme
@bitty/pipe
A pipe function to perform function composition in LTR (Left-To-Right) direction.
📦 Distributions in ESM, CommonJS, UMD and UMD minified formats.
⚡ Lightweight:
ramda.pipe
.🔋 Bateries included:
🏷 Safe:
This library is published in the NPM registry and can be installed using any compatible package manager.
npm install @bitty/pipe --save
# For Yarn, use the command below.
yarn add @bitty/pipe
This module has a UMD bundle available through JSDelivr and Unpkg CDNs.
<!-- For UNPKG use the code below. -->
<script src="https://unpkg.com/@bitty/pipe"></script>
<!-- For JSDelivr use the code below. -->
<script src="https://cdn.jsdelivr.net/npm/@bitty/pipe"></script>
<script>
// UMD module is exposed through the "pipe" global function.
console.log(pipe);
//=> "[Function: pipe]"
</script>
Import pipe
from package and just compose your functions with it.
import pipe from '@bitty/pipe';
const resolveToNumber = pipe(
(value: unknown) => typeof value === 'number' ? value : parseFloat(value),
(value: number) => Number.isNaN(value) ? 0 : value,
);
resolveToNumber('12389');
//=> 12389
The first pipe argument is an arity N function, so you can receive more than one argument in the composition.
import pipe from '@bitty/pipe';
const fromTextToWords = (text: string, wordsToIgnore: string[] = []) =>
text
.trim()
.split(/\s+/)
.filter((word) => !wordsToIgnore.includes(word));
const formatToInitials = pipe(
fromTextToWords,
(words) => words.map((word) => word.charAt(0)),
(initials) => initials.join('').toUpperCase(),
);
formatToInitials('abraão william de santana ', ['de']);
//=> "AWS"
Released under MIT License.
FAQs
A pipe function to perform function composition in LTR (Left To Right) direction.
The npm package @bitty/pipe receives a total of 3,519 weekly downloads. As such, @bitty/pipe popularity was classified as popular.
We found that @bitty/pipe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.