1 | 'use strict';
|
2 | module.exports = str => {
|
3 | const pth = str || process.cwd();
|
4 |
|
5 | if (pth === '/') {
|
6 | return ['/'];
|
7 | }
|
8 |
|
9 | const parts = pth.split(/[/\\]/);
|
10 |
|
11 | return parts.map((el, i) => parts.slice(0, parts.length - i).join('/').replace(/^$/, '/'));
|
12 | };
|