isChildOfDirectory = (dir, child) => {
  if (!dir || !child) return false
  const relative = path.relative(dir, child)
  return relative && !relative.startsWith('..') && !path.isAbsolute(relative)
}
Check whether a file or directory is a child of the given directory.

@param {string} dir The parent directory.
@param {string} child The file or directory path to check.