暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

index.mjs 404B

123456789101112131415161718
  1. import { dirname, resolve } from 'path';
  2. import { readdirSync, statSync } from 'fs';
  3. export default function (start, callback) {
  4. let dir = resolve('.', start);
  5. let tmp, stats = statSync(dir);
  6. if (!stats.isDirectory()) {
  7. dir = dirname(dir);
  8. }
  9. while (true) {
  10. tmp = callback(dir, readdirSync(dir));
  11. if (tmp) return resolve(dir, tmp);
  12. dir = dirname(tmp = dir);
  13. if (tmp === dir) break;
  14. }
  15. }