Added polyfill for find for array

This commit is contained in:
Thomas FORGIONE 2015-09-29 09:29:02 +02:00
parent 372f86a504
commit a6594f5119
2 changed files with 25 additions and 0 deletions

View File

@ -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 pg = require('pg');
var pgc = require('../../private.js'); var pgc = require('../../private.js');
var Log = require('../../lib/NodeLog.js'); var Log = require('../../lib/NodeLog.js');

View File

@ -1,4 +1,5 @@
#!/usr/bin/bash #!/usr/bin/bash
rm cookies*
for i in `seq 1 8`; do for i in `seq 1 8`; do
casperjs load.js --cookies-file=cookies"$i".txt& casperjs load.js --cookies-file=cookies"$i".txt&
done done