pyr
Version:
A package for creating a script to store and run your most commonly used CLI commands
41 lines (31 loc) • 813 B
JavaScript
const lodash = require('lodash');
const { throwError } = require('src/utility');
class Directory {
constructor(path = '') {
this.path = path;
}
static copy(directory) {
if (!(directory instanceof Directory)) {
throwError(`Directory.copy expects a Directory instance but instead recieved a ${(directory).constructor.name} instance`);
}
return lodash.cloneDeep(directory);
}
/**
* Returns the directories path
*
* @returns directories path
*/
getPath() {
return this.path;
}
/**
* Updates the directories path
*
* @argument string path - path to update the directories path
*/
updatePath(path) {
this.path = path;
}
}
module.exports = Directory;