mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-01-31 03:53:13 -05:00
16 lines
411 B
JavaScript
16 lines
411 B
JavaScript
|
'use strict';
|
||
|
var 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.
|
||
|
*/
|
||
|
function outsideDirectory(file, directory) {
|
||
|
return (path.relative(directory, file).indexOf('..') === 0);
|
||
|
}
|