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

funsyn

v1.0.6

Published

Lightweight functional syntax wrapper around JS built-in types' prototype methods; facilitates more consistent function composition.

Readme

funsyn

Lightweight functional syntax wrapper around JS built-in types' prototype methods; facilitates more consistent function composition.

So code you'd normally write like this, using functional ideas and object-oriented syntax:

[1, 2, 3, 4].map(n => n + 1).filter(n => n > 2); 

Can be written like this:

var { map, filter } = require('funsyn').Array;

filter(map([1, 2, 3, 4], n => n + 1), n => n > 2);

With no significant dependencies (the code is < 500 bytes).

How to use

npm install funsyn

For any method you'd normally call on an instance -- say, 'derp'.split -- require the funsyn version of the function and invoke it by passing the instance as the first argument, followed by any subsequent arguments:

var split = require('funsyn').String.split;

split('derp');     // => ['derp']
split('derp', ''); // => ['d', 'e', 'r', 'p']

Everything is located at Type.method within funsyn (e.g., String.split).

Note: presently only works for Array, Date, Object, RegExp, and String prototype methods. Maybe others should be included; these seemed like the most obviously useful ones.

How it works

This package does very little: it iterates over the aforementioned prototypes and exports syntactically modified versions of their methods, which delegate calls to the original methods using fn.apply() and the instance.

Why

To facilitate more consistent function composition. For one thing, you can maintain consistency between the way built-in and not-built-in functions are invoked, without having to monkey-patch the shit out of the built-in types. Say you have a function that flattens a two-dimensional array:

function flatten(arr) {
  return [].concat.apply([], arr);
}

If you want to "work within" the existing system, you might find yourself wanting to do something like:

someArray.map(doSomeStuff).flatten();

Which is cool, but to implement this you have to do something like this:

Array.prototype.flatten = function() {
  return flatten(this);
};

Which is emphatically not cool (because it modifies Array.prototype). You could also do this:

flatten(someArray.map(doSomeStuff));

But it somewhat annoyingly mixes the two styles.

So this allows you to do:

flatten(map(someArray, doSomeStuff));

Without any significant library dependencies.

Worth noting: you can do stuff like this in Firefox already, e.g., String.split('derp', ''). I haven't seen it anywhere else though, hence this package.

Why not just use underscore, lodash, etc?

If you need the additional functionality offered by those libraries, do use them.