1 |
- {"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["const { dirname, resolve } = require('path');\nconst { readdir, stat } = require('fs');\nconst { promisify } = require('util');\n\nconst toStats = promisify(stat);\nconst toRead = promisify(readdir);\n\nmodule.exports = async function (start, callback) {\n\tlet dir = resolve('.', start);\n\tlet tmp, stats = await toStats(dir);\n\n\tif (!stats.isDirectory()) {\n\t\tdir = dirname(dir);\n\t}\n\n\twhile (true) {\n\t\ttmp = await callback(dir, await toRead(dir));\n\t\tif (tmp) return resolve(dir, tmp);\n\t\tdir = dirname(tmp = dir);\n\t\tif (tmp === dir) break;\n\t}\n}\n"]}
|