Add existing to tracked
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
const path = require("path");
|
||||
|
||||
module.exports = outsideDirectory;
|
||||
|
||||
/**
|
||||
* Checks if a file is outside of a directory.
|
||||
*
|
||||
* @param {String} file Path to the file.
|
||||
* @param {String} directory Path to the directory.
|
||||
* @returns {Boolean} Whether the file is outside of the directory.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function outsideDirectory(file, directory) {
|
||||
return path.relative(directory, file).indexOf("..") === 0;
|
||||
}
|
||||
Reference in New Issue
Block a user