is-child

v0.0.6
Test whether a folder is the child ( or parent ) of another folder or file, using node path module

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
npm i is-child

Metadata

  • MIT
  • Whatever
  • phelm
  • released 12/12/2016

Downloads

Maintainers