[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
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 Array.prototype._reverse = Array.prototype.reverse; 16 17 Object.extend(Array.prototype, { 18 _each: function(iterator) { 19 for (var i = 0; i < this.length; i++) 20 iterator(this[i]); 21 }, 22 23 clear: function() { 24 this.length = 0; 25 return this; 26 }, 27 28 first: function() { 29 return this[0]; 30 }, 31 32 last: function() { 33 return this[this.length - 1]; 34 }, 35 36 compact: function() { 37 return this.select(function(value) { 38 return value != undefined || value != null; 39 }); 40 }, 41 42 flatten: function() { 43 return this.inject([], function(array, value) { 44 return array.concat(value.constructor == Array ? 45 value.flatten() : [value]); 46 }); 47 }, 48 49 without: function() { 50 var values = $A(arguments); 51 return this.select(function(value) { 52 return !values.include(value); 53 }); 54 }, 55 56 indexOf: function(object) { 57 for (var i = 0; i < this.length; i++) 58 if (this[i] == object) return i; 59 return -1; 60 }, 61 62 reverse: function(inline) { 63 return (inline !== false ? this : this.toArray())._reverse(); 64 }, 65 66 shift: function() { 67 var result = this[0]; 68 for (var i = 0; i < this.length - 1; i++) 69 this[i] = this[i + 1]; 70 this.length--; 71 return result; 72 }, 73 74 inspect: function() { 75 return '[' + this.map(Object.inspect).join(', ') + ']'; 76 } 77 });
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |