Sha256: 97b7b42ef6c5c5b20fe26876a974e45567d8c383d55cd49816a318fd501f68e2
Contents?: true
Size: 699 Bytes
Versions: 3
Compression:
Stored size: 699 Bytes
Contents
Array.method('is_empty', function() { return (this.length < 1) ? true : false; }); Array.method('not_empty', function() { return (this.length > 0) ? true : false; }); Array.method('each', function(callback) { try { if(doesNotExist(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); } } catch(error) { alert(error.message); } }); Array.method('contains', function(suspect) { var matches = []; this.each(function(value, index) { if(value === suspect) { matches.push(index); } }); return matches.not_empty() ? matches : false; });
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
judojs-0.9.4 | repository/judojs/utilities/array.js |
judojs-0.9.3 | repository/judojs/utilities/array.js |
judojs-0.9.2 | repository/judojs/utilities/array.js |