Remove dependency on underscore

Reviewed By: davidaurelio

Differential Revision: D2614853

fb-gh-sync-id: 706fb0db6852f599a1b3dd022dbc22aabb76539a
This commit is contained in:
Christoph Pojer 2015-11-04 18:58:25 -08:00 committed by facebook-github-bot-7
parent c731001864
commit bc9a3eb159
1 changed files with 9 additions and 9 deletions

View File

@ -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() {