Update of "No-Dash"

Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: 343c338e616e4ca4abe4290b0517221ede277ff7
Page Name:No-Dash
Date: 2014-09-27 22:50:22
Original User: andy
Mimetype:text/x-markdown
Parent: bd0b029ed7dcb464ea86be51a4c7c6bca9907dc3
Content

No-Dash

At this point, all the modern browsers (FF, Chrome, IE9, and Opera) support Object.defineProperty which can be used to safely add non-enumerable properties to the global prototypes. Thus, its possible to "monkey patch" utilities into all arrays, all objects, etc. No-Dash is a thin wrapper around Lo-Dash that does just this, copying the various categories of methods from Lo-Dash into the respective prototypes. A simple example:

require('nodash').install();

[1,2,3,4].max(); // Returns 4
[1,2,3,4].map(function(i) { return i*i; }); // returns [1,4,9,16]

No-Dash can be loaded with require as usual, and returns a module object which exports _ (from Lo-Dash) as well as the install method. No changes are made to the global prototypes unless install is called.

install optionally takes a list of strings as arguments, specifying the categories of functions to install. The available categories are

The default is to install everything except _.