2016-09-19 21:15:19 +00:00
|
|
|
"use strict";
|
2016-08-02 16:07:54 +00:00
|
|
|
module.exports = {
|
2019-01-04 16:36:14 +00:00
|
|
|
get: function(scope, prop, defaultValue){
|
|
|
|
let parts = prop.split(".");
|
|
|
|
let current = scope;
|
|
|
|
for (let i = 0; i < parts.length; i++){
|
|
|
|
if (current[parts[i]] !== undefined && i < parts.length - 1){
|
|
|
|
current = current[parts[i]];
|
|
|
|
}else if (current[parts[i]] !== undefined && i < parts.length){
|
|
|
|
return current[parts[i]];
|
|
|
|
}else{
|
|
|
|
return defaultValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return defaultValue;
|
2019-02-01 21:20:03 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
sanitize: function(filePath){
|
2019-04-10 15:13:47 +00:00
|
|
|
filePath = filePath.replace(/[^\w.-]/g, "_");
|
2019-03-08 15:36:20 +00:00
|
|
|
return filePath;
|
2019-01-04 16:36:14 +00:00
|
|
|
}
|
2016-08-02 16:07:54 +00:00
|
|
|
};
|