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