Skip to content

Commit

Permalink
Remove dependency on underscore
Browse files Browse the repository at this point in the history
Reviewed By: davidaurelio

Differential Revision: D2614853

fb-gh-sync-id: 706fb0db6852f599a1b3dd022dbc22aabb76539a
  • Loading branch information
cpojer authored and facebook-github-bot-7 committed Nov 5, 2015
1 parent 97135ee commit 7f93548
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packager/react-packager/src/DependencyResolver/fastfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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 }) {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 7f93548

Please sign in to comment.