
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Powerful TypeScript pipes with focus on size, performance and modularity.
yarn add pipem
Pipeables are functions that you can put into a pipe (pipe itself is Pipeable).
We try to make the number of core pipeables as low as possible so it's easy to build your own abstractions on top them.
Pipeable which runs either truePipeable or falsePipeable based on return value of predicate.
By default truePipeable returns Ok<$Input> and falsePipeable returns Err<Error<"FILTER", $Input>>.
filter((v: number) => !(v % 2));
filter(
(v: number) => !(v % 2),
() => ok("even"),
);
filter(
(v: number) => !(v % 2),
() => ok("even"),
() => ok("odd"),
);
It maps value from $Input to $Output and returns it as Ok<$Output>.
// Pipeable<number, Result<string, Error>>
const doubleString = map((v: number) => `${v * 2}`);
Pipeable which wraps a sub-pipeable and overrides its Error.
It's recommended to use error function to create a custom Error.
// Pipeable<number, Result<number, Error<"CUSTOM", number>>>
wrap(
map((v: number) => v * 2),
error("CUSTOM"),
);
Pipeable which takes N number of pipeables and returns either Ok returned by the last pipeable or Err returned by any of the pipeables.
// Pipeable<number, Result<string, Error<"FILTER", number> | Error<"CUSTOM", number>>>
const customPipe = pipe(
filter((v: number) => !(v % 2)),
wrap(
map((v) => `${v}`),
error("CUSTOM"),
),
);
Pipeable which takes N number of pipeables and returns either Ok returned by any of the pipeables or Err if none of the pipeables returned Ok.
// Pipeable<number, Result<number, Error<"OR", number>>>
const customPipe = or(
filter((v: number) => !(v % 2)),
filter((v: number) => !(v % 3)),
);
Pipe is just and.
Creates error tuple based on value and potential sub-error.
It should mainly be used in wrap function as a second parameter.
All Pipeables should return error created with this function.
error("TEST", (value, error) => ({ valueType: typeof value, error }));
Allows to run Pipeable with unknown input while infering everything else from the Pipeable as usual.
const isStringOrNumber = pipe(...);
// ResultErr<["OR", [], { }]>
const result1 = parse(isStringOrNumber, []);
// ResultOk<1>
const result2 = parse(isStringOrNumber, 1);
and/pipe and or can take only up to 32 PipeablesPipeablesHave a beautiful day 🍀.
FAQs
Powerful TypeScript pipes with focus on size, performance and modularity.
We found that pipem demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.