picanhajs
Version:
A tasty website static generator
31 lines (24 loc) • 644 B
JavaScript
;
// Dependencies
var CustomErrors = require('./CustomErrors'),
ncp = require('ncp').ncp;
var Utils = {
parameterCheck : function (type, arg){
if (!arg && arg !== 0 && arg !== false && arg !== '')
throw new CustomErrors.ParameterNotFound();
else if (!(arg instanceof type))
throw new TypeError("Expected an " + type.toString() + " as parametes for this constructor.");
},
recursiveCopy : function (src, dest){
return new Promise((resolve, reject) => {
ncp(src, dest, (error) => {
if (error) {
reject(error);
return false;
}
resolve(dest);
});
});
}
};
module.exports = Utils;