npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pipeline.sjs

v1.0.2

Published

Naturally expressive functional composition

Readme

Pipeline.sjs

Version: 1.0.2 Master build: Master branch build status

This library provides pipelining syntax to achieve naturally expressive functional composition with a little help from Sweet.js. It can be installed in whichever way you prefer, but I recommend NPM.

The motivation was to make reading functional composition more natural by writing left to right rather than inside out. My original choice of operator was |> to match a similar operator in Elixir, but due to some limitations of Sweet.js this wasn't possible. The examples below show usage with the default >> operator.

Usage examples

var foo = function(){},
    bar = function(){},
    baz = function(){};

// Basic composition
123 >> foo; // Compiles to foo(123);

// Functional composition
foo >> bar; // Compiles to bar(foo);

// Chained composition
123 >> foo >> bar; // Compiles to bar(foo(123));

// Multi-line composition
123
>> foo
>> bar
>> baz; // Compiles to baz(bar(foo(123)));

// Partially applied composition
foo >> bar >> baz(123); // Compiles to baz(123, bar(foo));

// Partially applied with many arguments
foo >> bar(1, 2, 3) >> baz; // Compiles to baz(bar(1, 2, 3, foo));

Transpiling

Whenever you use this or any other Sweet.js macro, you need to run it through sjs.

$ npm install pipeline.sjs sweet.js
$ node_modules/.bin/sjs -m pipeline.sjs/macro mysweetfile.sjs

Custom operator

You can change the operator used in this macro by running the build script with your new operator.

$ MACRO_OP='>>' npm run build

Contributing

I accept contributions to the source via Pull Request, but passing unit tests must be included before it will be considered for merge.

$ npm run build
$ npm test

If you have Vagrant installed, you can build the dev environment to assist development. The repository will be mounted in /srv.

$ curl -O https://raw.github.com/adlawson/vagrantfiles/master/nodejs/Vagrantfile
$ vagrant up
$ vagrant ssh

Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)
$ cd /srv

License

The content of this library is released under the MIT License by Andrew Lawson. You can find a copy of this license in LICENSE or at http://www.opensource.org/licenses/mit.