From bc9a3eb15965946bb56a9bc89f9ad115f9ab14aa Mon Sep 17 00:00:00 2001 From: Christoph Pojer Date: Wed, 4 Nov 2015 18:58:25 -0800 Subject: [PATCH] Remove dependency on underscore Reviewed By: davidaurelio Differential Revision: D2614853 fb-gh-sync-id: 706fb0db6852f599a1b3dd022dbc22aabb76539a --- .../src/DependencyResolver/fastfs.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/react-packager/src/DependencyResolver/fastfs.js b/react-packager/src/DependencyResolver/fastfs.js index 623df232..7864049b 100644 --- a/react-packager/src/DependencyResolver/fastfs.js +++ b/react-packager/src/DependencyResolver/fastfs.js @@ -4,7 +4,6 @@ const Activity = require('../Activity'); const Promise = require('promise'); const {EventEmitter} = require('events'); -const _ = require('underscore'); const fs = require('fs'); const path = require('path'); @@ -62,10 +61,8 @@ class Fastfs extends EventEmitter { } getAllFiles() { - return _.chain(this._roots) - .map(root => root.getFiles()) - .flatten() - .value(); + // one-level-deep flatten of files + return [].concat(...this._roots.map(root => root.getFiles())); } findFilesByExt(ext, { ignore }) { @@ -278,13 +275,16 @@ class File { } getFiles() { - return _.flatten(_.values(this.children).map(file => { + const files = []; + Object.keys(this.children).forEach(key => { + const file = this.children[key]; if (file.isDir) { - return file.getFiles(); + files.push(...file.getFiles()); } else { - return file; + files.push(file); } - })); + }); + return files; } ext() {