Remove code dependencies to underscore

This commit is contained in:
Anthony Laibe 2018-07-24 13:29:06 +01:00 committed by Iuri Matias
parent 8c4a67e59c
commit 2a3eb14899
2 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,6 @@
let async = require('async');
const _ = require('underscore');
const utils = require('../utils/utils.js');
const ContractDeployer = require('./contract_deployer.js');
const cloneDeep = require('clone-deep');

View File

@ -447,6 +447,25 @@ function interceptLogs(consoleContext, logger) {
};
}
function compact(array) {
return array.filter(n => n);
}
function groupBy(array, key) {
return array.reduce(function(rv, x) {
(rv[x[key]] = rv[x[key]] || []).push(x);
return rv;
}, {});
}
function sample(array) {
return array[Math.floor(Math.random() * array.length)];
}
function last(array) {
return array[array.length - 1];
}
module.exports = {
joinPath,
dirname,