diff --git a/lib/contracts/compiler.js b/lib/contracts/compiler.js index f7a7c70ef..3d282266e 100644 --- a/lib/contracts/compiler.js +++ b/lib/contracts/compiler.js @@ -1,18 +1,7 @@ /*jshint esversion: 6, loopfunc: true */ -var async = require('async'); +var async = require('../core/async_extend.js'); var SolcW = require('./solcW.js'); -function asyncEachObject(object, iterator, callback) { - async.each( - Object.keys(object || {}), - function(key, next){ - iterator(key, object[key], next); - }, - callback - ); -} -async.eachObject = asyncEachObject; - var Compiler = function(options) { this.plugins = options.plugins; this.logger = options.logger; diff --git a/lib/core/async_extend.js b/lib/core/async_extend.js new file mode 100644 index 000000000..1c6db4f5c --- /dev/null +++ b/lib/core/async_extend.js @@ -0,0 +1,14 @@ +var async = require('async'); + +function asyncEachObject(object, iterator, callback) { + async.each( + Object.keys(object || {}), + function(key, next){ + iterator(key, object[key], next); + }, + callback + ); +} +async.eachObject = asyncEachObject; + +module.exports = async; diff --git a/lib/core/services_monitor.js b/lib/core/services_monitor.js index 402eb1e7d..0dd119198 100644 --- a/lib/core/services_monitor.js +++ b/lib/core/services_monitor.js @@ -1,16 +1,4 @@ -var async = require('async'); - -// TODO: repeated, add this to an async extensions file -function asyncEachObject(object, iterator, callback) { - async.each( - Object.keys(object || {}), - function(key, next){ - iterator(key, object[key], next); - }, - callback - ); -} -async.eachObject = asyncEachObject; +var async = require('./async_extend.js'); var ServicesMonitor = function(options) { this.events = options.events;