From c1526a1add26c9d4caaf39237171204d6cf20e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Usarz?= Date: Fri, 25 May 2018 17:03:56 +0200 Subject: [PATCH] refactor(reporter): update lib/reporter/multi.js to ES6 (#3018) --- lib/reporters/multi.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/reporters/multi.js b/lib/reporters/multi.js index eba03f6a3..482b1a4aa 100644 --- a/lib/reporters/multi.js +++ b/lib/reporters/multi.js @@ -1,18 +1,19 @@ -var helper = require('../helper') +'use strict' -var MultiReporter = function (reporters) { - this.addAdapter = function (adapter) { - reporters.forEach(function (reporter) { - reporter.adapters.push(adapter) - }) +const helper = require('../helper') + +class MultiReporter { + constructor (reporters) { + this._reporters = reporters + } + + addAdapter (adapter) { + this._reporters.forEach((reporter) => reporter.adapters.push(adapter)) } - this.removeAdapter = function (adapter) { - reporters.forEach(function (reporter) { - helper.arrayRemove(reporter.adapters, adapter) - }) + removeAdapter (adapter) { + this._reporters.forEach((reporter) => helper.arrayRemove(reporter.adapters, adapter)) } } -// PUBLISH module.exports = MultiReporter