Enhancing Number Prototype with Pipeable Functionality

Any love? ❤️ I'm getting used to everything being pipable. (I'll probably publish a separate package that extends every js primitive)

import { type Pipeable, pipeArguments } from "effect/Pipeable";

Number.prototype.pipe = function () {
    return pipeArguments(this, arguments);
};

declare global {
    interface Number extends Pipeable {}
}

const s = 4;
console.log(s.pipe((x) => x + 1)); // 5
Was this page helpful?