mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-02 13:11:05 -05:00
29 lines
710 B
JavaScript
29 lines
710 B
JavaScript
|
module.exports = function (store) {
|
||
|
function getset (name, value) {
|
||
|
var node = vars.store;
|
||
|
var keys = name.split('.');
|
||
|
keys.slice(0,-1).forEach(function (k) {
|
||
|
if (node[k] === undefined) node[k] = {};
|
||
|
node = node[k]
|
||
|
});
|
||
|
var key = keys[keys.length - 1];
|
||
|
if (arguments.length == 1) {
|
||
|
return node[key];
|
||
|
}
|
||
|
else {
|
||
|
return node[key] = value;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var vars = {
|
||
|
get : function (name) {
|
||
|
return getset(name);
|
||
|
},
|
||
|
set : function (name, value) {
|
||
|
return getset(name, value);
|
||
|
},
|
||
|
store : store || {},
|
||
|
};
|
||
|
return vars;
|
||
|
};
|