repository/ninjs/utilities/array.js in ninjs-0.14.1 vs repository/ninjs/utilities/array.js in ninjs-0.16.0
- old
+ new
@@ -1,29 +1,29 @@
-Array.method('is_empty', function() {
+Array.prototype.is_empty = function() {
return is_empty(this);
-});
+};
-Array.method('not_empty', function() {
+Array.prototype.not_empty = function() {
return is_not_empty(this);
-});
+};
-Array.method('each', function(callback) {
+Array.prototype.each = function(callback) {
if(is_undefined(callback)) {
throw new SyntaxError("Array.each(callback): callback is undefined");
}
for (var i = 0; i < this.length; i++) {
var args = [this[i], i];
callback.apply(this, args);
}
-});
+};
-Array.method('contains', function(suspect) {
+Array.prototype.contains = function(suspect) {
var matches = [];
this.each(function(value, index) {
if(value === suspect) {
matches.push(index);
}
});
return matches.not_empty() ? matches : false;
-});
+};
\ No newline at end of file