MCPcopy
hub / github.com/shelljs/shelljs / _parseStackIndex

Function _parseStackIndex

src/dirs.js:22–31  ·  view source on GitHub ↗
(index)

Source from the content-addressed store, hash-verified

20}
21
22function _parseStackIndex(index) {
23 if (_isStackIndex(index)) {
24 if (Math.abs(index) < _dirStack.length + 1) { // +1 for pwd
25 return (/^-/).test(index) ? Number(index) - 1 : Number(index);
26 }
27 common.error(index + ': directory stack index out of range');
28 } else {
29 common.error(index + ': invalid number');
30 }
31}
32
33function _actualDirStack() {
34 return [process.cwd()].concat(_dirStack);

Callers 3

_pushdFunction · 0.85
_popdFunction · 0.85
_dirsFunction · 0.85

Calls 1

_isStackIndexFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…