You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
319 B

4 years ago
  1. 'use strict';
  2. const path = require('path');
  3. const pathIsInside = require('path-is-inside');
  4. module.exports = (childPath, parentPath) => {
  5. childPath = path.resolve(childPath);
  6. parentPath = path.resolve(parentPath);
  7. if (childPath === parentPath) {
  8. return false;
  9. }
  10. return pathIsInside(childPath, parentPath);
  11. };