"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/binary/lib/vars.js" (7 Feb 2017, 710 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 module.exports = function (store) {
    2     function getset (name, value) {
    3         var node = vars.store;
    4         var keys = name.split('.');
    5         keys.slice(0,-1).forEach(function (k) {
    6             if (node[k] === undefined) node[k] = {};
    7             node = node[k]
    8         });
    9         var key = keys[keys.length - 1];
   10         if (arguments.length == 1) {
   11             return node[key];
   12         }
   13         else {
   14             return node[key] = value;
   15         }
   16     }
   17     
   18     var vars = {
   19         get : function (name) {
   20             return getset(name);
   21         },
   22         set : function (name, value) {
   23             return getset(name, value);
   24         },
   25         store : store || {},
   26     };
   27     return vars;
   28 };