Created
April 1, 2018 14:45
-
-
Save brainysmurf/2cfad0e6530672deaa915f827c8a6cfb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(global,name,Package,helpers){var ref=function wrapper(args){var wrapped=function(){return Package.apply(global.Import&&Import.module?Import._import(name):global[name],[global].concat(Array.prototype.slice.call(arguments)))};for(i in args){wrapped[i]=args[i]}return wrapped}(helpers);if(global.Import&&Import.module){Import.register(name,ref)}else{Object.defineProperty(global,name,{value:ref});global.Import=global.Import||function(lib){return global[lib]};Import.module=false}})(this, | |
"PropertyStore", | |
function PropertyStorePackage_ (global, config) { | |
config = config || {}; | |
config.jsons = config.jsons || false; | |
var PropertyObject = function (_propertyObject) { | |
return { | |
set: function (key, value) { | |
if (config.jsons) value = JSON.stringify(value); | |
_propertyObject.setProperty(key, value); | |
}, | |
get: function (key) { | |
var ret; | |
ret = _propertyObject.getProperty(key); | |
if (config.jsons) { | |
ret = JSON.parse(ret || 'null'); | |
} | |
return ret; | |
}, | |
}; | |
}; | |
return { | |
script: function () { | |
return PropertyObject(PropertiesService.getScriptProperties()); | |
}, | |
document: function () { | |
return PropertyObject(PropertiesService.getDocumentProperties()); | |
}, | |
user: function () { | |
return PropertyObject(PropertiesService.getUserProperties()); | |
} | |
} | |
}, | |
{ /* helpers */ } | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment