is-child

0.0.6 • Public • Published

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

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i is-child

    Weekly Downloads

    7

    Version

    0.0.6

    License

    MIT

    Last publish

    Collaborators

    • phelm