UNPKG
@onlabsorg/stilo
Version:
latest (0.19.4)
0.19.4
0.19.3
0.19.2
0.19.1
0.19.0
0.18.0
0.17.1
0.17.0
0.16.0
0.15.5
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.1
0.14.0
0.13.1
0.13.0
0.12.1
0.12.0
Command line tool for managing olojs document packages
github.com/onlabsorg/stilo
onlabsorg/stilo
@onlabsorg/stilo
/
test
/
test-repository
/
.stilo
/
node_modules
/
is-path-inside
/
index.js
13 lines
(10 loc)
•
292 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
import
path
from
'node:path'
;
export
default
function
isPathInside
(
childPath, parentPath
) {
const
relation = path.
relative
(parentPath, childPath);
return
Boolean
( relation && relation !==
'..'
&& !relation.
startsWith
(
`..
${path.sep}
`
) && relation !== path.
resolve
(childPath) ); }