is-child
v0.0.6
Published
Test whether a folder is the child ( or parent ) of another folder or file, using node path module
Downloads
21
Readme
Tests whether a file / folder is the child of another file.
isChild(parent, child)
returns true or false
Can also be used to test if a folder is the parent of a file / folder (just swap the arguments 😉 )
npm install is-child
let isChild = require('is-child');
let parent = '/my/path'
let child = '/my/path/child'
let random = '/my/random/path'
isChild(parent, child) // returns true
isChild(parent, random) // returns false