2.5.0 • Published 11 years ago

dundee v2.5.0

Weekly downloads
2
License
-
Repository
github
Last release
11 years ago

Description

Extend native objects with methods prefixed by '_'

Latest Version

3.0.0

Installation

in package.json

{
  ...
  "dependencies": {
    "dundee": "3.0.0"
  }
  ...
}

Usage

Basic example including isEmpty from Dundee Array extensions

var Dundee = require('dundee');

Dundee.Array.include('isEmpty');

var x = [];
x._isEmpty(); // true
x.push(2);
x._isEmpty(); // false

Dundee.Array.remove('isEmpty');
x._isEmpty(); // throws error ~= /has no method/
// include all Dundee Array extensions
Dundee.Array.include()

// include a single extension
Dundee.Array.include('isEmpty')

// use array argument to include multiple extensions
Dundee.Array.include(['pluck', 'reject'])

// include user defined extensions
Dundee.Array.include({
  derp : function () {},
  honk : function () {}
});

// remove all array extensions
Dundee.Array.remove()

// remove a single extension
Dundee.Array.remove('isEmpty')

// remove multiple extensions
Dundee.Array.remove(['pluck', 'reject', 'derp', 'honk'])

TODO

string

camelize contains count enclose extract forEach forEachWord linkify many randomize remove reverse shorten sort toDOM trim wrap

ltrim rtrim

http://stackoverflow.com/questions/1137436/what-are-useful-javascript-methods-that-extends-built-in-objects

##function

// detect native method in object // not same scope of isHostObject isNative = function(object, method) { return object && method in object && typeof objectmethod != 'string' && // IE & W3C browser return "native code" // Safari < = 2.0.4 will return "function" (/{\s[native code]\s}|^[function]$/).test(objectmethod); }

var isArray = (function() { var testString = Object.prototype.toString.call([]); return function(o) { return Object.prototype.toString.call(o) == testString; }; })();

#Build status build status

2.5.0

11 years ago

2.4.0

11 years ago

2.3.0

12 years ago

2.2.0

12 years ago

2.1.0

12 years ago

0.0.1

12 years ago