Jeff Williams a0f8d178aa refactor: extract most of @jsdoc/core into @jsdoc/util
BREAKING CHANGE: Most modules in `@jsdoc/core` have moved.
2019-12-31 14:40:14 -08:00

20 lines
424 B
JavaScript

/**
* @alias @jsdoc/util.fs
*/
const _ = require('lodash');
const klawSync = require('klaw-sync');
const path = require('path');
exports.lsSync = ((dir, opts = {}) => {
const depth = _.has(opts, 'depth') ? opts.depth : -1;
const files = klawSync(dir, {
depthLimit: depth,
filter: (f => !path.basename(f.path).startsWith('.')),
nodir: true
});
return files.map(f => f.path);
});