Added polyfill for find for array
This commit is contained in:
parent
372f86a504
commit
a6594f5119
|
@ -1,3 +1,27 @@
|
|||
// Polyfill of find array
|
||||
if (!Array.prototype.find) {
|
||||
Array.prototype.find = function(predicate) {
|
||||
if (this == null) {
|
||||
throw new TypeError('Array.prototype.find a été appelé sur null ou undefined');
|
||||
}
|
||||
if (typeof predicate !== 'function') {
|
||||
throw new TypeError('predicate doit être une fonction');
|
||||
}
|
||||
var list = Object(this);
|
||||
var length = list.length >>> 0;
|
||||
var thisArg = arguments[1];
|
||||
var value;
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
value = list[i];
|
||||
if (predicate.call(thisArg, value, i, list)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
|
||||
var pg = require('pg');
|
||||
var pgc = require('../../private.js');
|
||||
var Log = require('../../lib/NodeLog.js');
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/bash
|
||||
rm cookies*
|
||||
for i in `seq 1 8`; do
|
||||
casperjs load.js --cookies-file=cookies"$i".txt&
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue