Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Sloth Pipe is a library for TypeScript and JavaScript designed to facilitate the creation of lazy, chainable, and reusable pipes for data transformation and processing. Borrowing from functional programming paradigms, it offers a convenient and powerful way to compose functions and manage data flow in an application, with an emphasis on lazy evaluation and efficient execution.
To install Sloth Pipe, use the following command:
bun i sloth-pipe
or
npm install sloth-pipe
Here's a simple example of how to use Sloth Pipe:
import { Pipe } from "sloth-pipe";
const result = Pipe(5)
.to((x) => x * 2)
.to((x) => x + 3)
.exec();
console.log(result); // Outputs: 13
Sloth Pipe seamlessly integrates with asynchronous operations:
const add = async (x: Promise<number>, y: number) => {
const xVal = await x;
return xVal + y;
};
const asyncResult = await Pipe(5)
.to(async (x) => x * 2)
.to(add, 3) // pass additional arguments to any function
.exec();
console.log(asyncResult); // Outputs: 13
Handle errors gracefully within the pipe:
const safeResult = Pipe(5)
.to((x) => {
if (x > 0) throw new Error("Example error");
return x;
})
.catch((err) => 0)
.exec();
console.log(safeResult); // Outputs: 0
The API consists of a few key methods: to
, tap
, exec
, and catch
. For a detailed reference,
please refer to the API documentation.
Any and all contributions are welcome! Open an issue or submit a pull request to contribute.
This project uses Bun for development. To get started, clone the repository and
run bun install
to install dependencies. Then, run bun test
to run the test suite.
To build the project, run bun build
. The output will be in the dist
directory.
This project is licensed under the MIT License.
FAQs
A pipe utility that lazily evaluates only when needed, and only once.
The npm package sloth-pipe receives a total of 263 weekly downloads. As such, sloth-pipe popularity was classified as not popular.
We found that sloth-pipe demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.