[ Index ] |
|
Code source de PRADO 3.0.6 |
1 var $A = Array.from = function(iterable) { 2 if (!iterable) return []; 3 if (iterable.toArray) { 4 return iterable.toArray(); 5 } else { 6 var results = []; 7 for (var i = 0; i < iterable.length; i++) 8 results.push(iterable[i]); 9 return results; 10 } 11 } 12 13 Object.extend(Array.prototype, Enumerable); 14 15 if (!Array.prototype._reverse) 16 Array.prototype._reverse = Array.prototype.reverse; 17 18 Object.extend(Array.prototype, { 19 _each: function(iterator) { 20 for (var i = 0; i < this.length; i++) 21 iterator(this[i]); 22 }, 23 24 clear: function() { 25 this.length = 0; 26 return this; 27 }, 28 29 first: function() { 30 return this[0]; 31 }, 32 33 last: function() { 34 return this[this.length - 1]; 35 }, 36 37 compact: function() { 38 return this.select(function(value) { 39 return value != undefined || value != null; 40 }); 41 }, 42 43 flatten: function() { 44 return this.inject([], function(array, value) { 45 return array.concat(value && value.constructor == Array ? 46 value.flatten() : [value]); 47 }); 48 }, 49 50 without: function() { 51 var values = $A(arguments); 52 return this.select(function(value) { 53 return !values.include(value); 54 }); 55 }, 56 57 indexOf: function(object) { 58 for (var i = 0; i < this.length; i++) 59 if (this[i] == object) return i; 60 return -1; 61 }, 62 63 reverse: function(inline) { 64 return (inline !== false ? this : this.toArray())._reverse(); 65 }, 66 67 inspect: function() { 68 return '[' + this.map(Object.inspect).join(', ') + ']'; 69 } 70 });
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |