parentPaths.js 265 B

12345678910111213
  1. 'use strict';
  2. module.exports = function parentPaths(path) {
  3. const pieces = path.split('.');
  4. let cur = '';
  5. const ret = [];
  6. for (let i = 0; i < pieces.length; ++i) {
  7. cur += (cur.length > 0 ? '.' : '') + pieces[i];
  8. ret.push(cur);
  9. }
  10. return ret;
  11. };