From 0469abd4a9c9270a1fdc962969e36e63699af8b4 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 10 Dec 2017 21:51:33 +0100 Subject: upgrade dependencies --- node_modules/webpack-sources/lib/ConcatSource.js | 54 ++++++++++++++++++------ 1 file changed, 40 insertions(+), 14 deletions(-) (limited to 'node_modules/webpack-sources/lib/ConcatSource.js') diff --git a/node_modules/webpack-sources/lib/ConcatSource.js b/node_modules/webpack-sources/lib/ConcatSource.js index 8dc712d9c..b2b59707b 100644 --- a/node_modules/webpack-sources/lib/ConcatSource.js +++ b/node_modules/webpack-sources/lib/ConcatSource.js @@ -11,25 +11,47 @@ const Source = require("./Source"); class ConcatSource extends Source { constructor() { super(); - this.children = Array.prototype.slice.call(arguments); + this.children = []; + for(var i = 0; i < arguments.length; i++) { + var item = arguments[i]; + if(item instanceof ConcatSource) { + var children = item.children; + for(var j = 0; j < children.length; j++) + this.children.push(children[j]); + } else { + this.children.push(item); + } + } } add(item) { - this.children.push(item); + if(item instanceof ConcatSource) { + var children = item.children; + for(var j = 0; j < children.length; j++) + this.children.push(children[j]); + } else { + this.children.push(item); + } } source() { - return this.children.map(function(item) { - return typeof item === "string" ? item : item.source(); - }).join(""); + let source = ""; + const children = this.children; + for(let i = 0; i < children.length; i++) { + const child = children[i]; + source += typeof child === "string" ? child : child.source(); + } + return source; } size() { - return this.children.map(function(item) { - return typeof item === "string" ? item.length : item.size(); - }).reduce(function(sum, s) { - return sum + s; - }, 0); + let size = 0; + const children = this.children; + for(let i = 0; i < children.length; i++) { + const child = children[i]; + size += typeof child === "string" ? child.length : child.size(); + } + return size; } node(options) { @@ -41,22 +63,26 @@ class ConcatSource extends Source { listMap(options) { const map = new SourceListMap(); - this.children.forEach(function(item) { + var children = this.children; + for(var i = 0; i < children.length; i++) { + var item = children[i]; if(typeof item === "string") map.add(item); else map.add(item.listMap(options)); - }); + } return map; } updateHash(hash) { - this.children.forEach(function(item) { + var children = this.children; + for(var i = 0; i < children.length; i++) { + var item = children[i]; if(typeof item === "string") hash.update(item); else item.updateHash(hash); - }); + } } } -- cgit v1.2.3