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

dotdot

v0.1.2

Published

Replaced foo..bar() with foo.bar.bind(foo) to shorten common JS syntax under node

Readme

dotdot

Replaced foo..bar() with foo.bar.bind(foo) automatically using Nodejs require hook

NPM

Build status dependencies devdependencies

endorse

dotdot installs a Node loader hook that transforms each loaded JavaScript file.

var foo = {
    n: 101,
    print: function () {
        console.log(n);
    }
};
var printN = foo..print();
printN();
// becomes
var foo = {
    n: 101,
    print: function () {
        console.log(n);
    }
};
var printN = foo.print.bind(foo);
printN();
// prints
101

Both object properties and stand alone functions are supported, including arguments

foo..bar('arg1', 'arg2')  //=> foo.bar.bind(foo, 'arg1', 'arg2')
bar..(3, 'something') //=> bar.bind(null, 3, 'something')

for more examples see test/e2e.js

install and use

npm install --save dotdot

then require dotdot BEFORE any source files with .. are required. The hook does NOT transform the file that loads dotdot itself, since it is too late.

// index.js
require('dotdot');
require('./add');
// add.js
function add(a, b) { return a + b; }
add..(2)(3) // 5
add..(10, 11)() // 21

performance

The source code transformation happens once per file, on the first require call. The substitution itself is a simple RegExp execution, there is no abstract syntax tree, so it should be fast enough.

Later I plan to support a filter function / option to limit substitution to certain files, for example to avoid transforming any source file loaded from node_modules folder.

why?

I got tired of constantly writing .bind(null, ...), especially in promise chains. I looked at using sweet.js macros, but that project is still too fresh (most of their own examples did not work using v0.3.x), and too ambitious for this small change. Now my promise chains are much cleaner:

// compare
asyncSquare(2)
.then(console.log.bind(null, '2 ='))
.then(asyncSquare..(3))
.then(console.log.bind(null, '3 ='))
.then(asyncSquare..(4))
.then(console.log.bind(null, '4 ='));

// with
asyncSquare(2)
.then(console..log('2 ='))
.then(asyncSquare..(3))
.then(console..log('3 ='))
.then(asyncSquare..(4))
.then(console..log('4 ='));

Small print

Author: Gleb Bahmutov © 2013

License: MIT - do anything with the code, but don't blame me if it does not work.

Support: if you find any problems with this module, email / tweet / open issue on Github