UnlimitJS allows for chaining with native JavaScript objects without extending objects' prototype s. It has a simply API and increases the readability of common code.

  1. for in loops are safe to use
  2. Chaining is super easy obj[fun]()[fun]()
  3. Unlimitjs is Javascript, no compiling

UnlimitJS intends to bring chaining and readability to Javascript.
Instead of writing: trim(' string ') you write ' string '[trim]()

var trim = function(){
  return this.replace(/^\s+|\s+$/g,'');

alert( ' string '[trim]() );

Here is another example

var yell = function(){
  return this;

'Example string'[yell]()[yell]();


Unlimit isn't exactly intended for libraries to create tons of global functions like trim and yell. Unlimit is geared towards allowing methods to easily be chained without nested functions. The practicality and readability is demonstrated when you can change this jQuery snippet.

alert($.map($.trim($('input.name').val()).split(' '),function(str){
  return str.replace(/[-^&]/,'');
}).join(' '));


// one time set up

     $('input.name').val()[$.trim]().split(' ')
       return str.replace(/[-^&]/,'');
     }).join(' ')

underscore.js + Unlimit

// Unlimit underscore.js library
for(var i in _)_[i][Unlimit](true);

  // strip falsey values

underscore.js + Unlimit

var Mammal = function(){};
var Dog = function(){};

Dog.prototype = new Mammal();




Calling [Unlimit]() binds the this context to the object you are calling on.

var yell = function(){
  return alert(''+this);

'This string is bond to "this" in function.'[yell]()

Calling [Unlimit](true) tells the object your calling on to be passed as the first argument to the function.

var yell = function(obj){
  return alert(''+obj);

'1st argument is bound to this string.'[yell]()

Calling object[Unlimit](function(){}) allows you to unlimit objects other then Function s.

var yell = {};

'This string is bond to the attached function.'[yell]()

Known Issues

  1. You can no longer decompile a function that has been Unlimit ed. In fact you shouldn't decompile a function period. It isn't cross browser and can cause bugs. If you have to do the following Function.prototype.toString.call(object);
  2. Unlimit doesn't work on Host Objects in IE<9. That basically means you can't expect to call Unlimit ed functions on NodeList s, or native DOM Element s. For example this will fail in IE<9.

    var toArray = function(){
      return Array.prototype.slice.call(this,0);
    var body = document.getElementsByTagName('div')[toArray]();