// before: for (var i == 0; i < bigArray.length; i++) { if (bigArray[i].isSelected) { bigArray[i].onDeselect = (function(i) { return function() { doSomething(i); } })(i); } if (!bigArray[i].isSelectable) { break; } } // after: Ox.forEach(bigArray, function(v, i) { if (v.isSelected) { v.onDeselect = function() { doSomething(i); }; } return v.isSelectable; }); // before: var exists = array.indexOf(value) > -1; // after: var exists = Ox.contains(array, value); // before: var key; for (var k in obj) { if (obj[k] === value) { key = k; break; } } // after: var key = Ox.keyOf(object, value); // before: var last = arrayWithLongName[arrayWithLongName.length - 1]; // after: var last = Ox.last(arrayWithLongName); // before: arrayWithLongName[arrayWithLongName.length - 1] = 0; // after: Ox.last(arrayWithLongName, 0); // before: myNumber = Math.min(Math.max(myNumber, min), max); // after: myNumber = Ox.limit(myNumber, min, max); // before: var random = min + Math.floor(Math.random() * (max - min)); // after: var random = Ox.random(min, max); // before: var mod = -1 % 10 // -1; // after: var mod = Ox.mod(-1, 10) // 9