mirror of https://github.com/status-im/metro.git
Remove dependency on underscore
Reviewed By: davidaurelio Differential Revision: D2614853 fb-gh-sync-id: 706fb0db6852f599a1b3dd022dbc22aabb76539a
This commit is contained in:
parent
c731001864
commit
bc9a3eb159
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue