ember-cli
Version:
Command line tool for developing ambitious ember.js apps
24 lines (17 loc) • 390 B
JavaScript
;
const path = require('path');
let regex = /^[./]$/;
function walkUp(thePath) {
let paths = [];
let currentPath = thePath;
// eslint-disable-next-line no-constant-condition
while (true) {
currentPath = path.dirname(currentPath);
if (regex.test(currentPath)) {
break;
}
paths.push(currentPath);
}
return paths;
}
module.exports = walkUp;