stores/localstorage.js
function prostrate(source){
  return function(method, transform){
    transform = transform || {};
    return function(){
      var args = Array.prototype.slice.call(arguments, 0),
        fn = args.pop(),
        res,
        last;

      if(args[0] && ['removeItem', 'getItem', 'setItem'].indexOf(method) > -1){
        var id = args[0];
        id = id.toString();
        if(id.indexOf(module.exports.ns) === -1){
          id = module.exports.ns + id;
        }
        args[0] = id;
      }
      if(args.length == 2 && transform.before){
        args[1] = transform.before(args[1]);
      }
      if(method === 'key'){
        assert(typeof args[0] === 'number', args[0] + ' must be a number');
      }
      if(!source[method]){
        throw new Error('Unknown localstorage method ' + method);
      }
      else{
        if(source[method].apply){
          res = source[method].apply(source, args);
          debug('result for ' +  method, '(', args, ')', res);
        }
        else {
          res = source[method];
        }
      }

      try{
        if(transform.after){
          res = transform.after(res);
        }
      }
      catch(e){}
      fn(null, res);
    };
  };
}
function prostrate(source){
  return function(method, transform){
    transform = transform || {};
    return function(){
      var args = Array.prototype.slice.call(arguments, 0),
        fn = args.pop(),
        res,
        last;

      if(args[0] && ['removeItem', 'getItem', 'setItem'].indexOf(method) > -1){
        var id = args[0];
        id = id.toString();
        if(id.indexOf(module.exports.ns) === -1){
          id = module.exports.ns + id;
        }
        args[0] = id;
      }
      if(args.length == 2 && transform.before){
        args[1] = transform.before(args[1]);
      }
      if(method === 'key'){
        assert(typeof args[0] === 'number', args[0] + ' must be a number');
      }
      if(!source[method]){
        throw new Error('Unknown localstorage method ' + method);
      }
      else{
        if(source[method].apply){
          res = source[method].apply(source, args);
          debug('result for ' +  method, '(', args, ')', res);
        }
        else {
          res = source[method];
        }
      }

      try{
        if(transform.after){
          res = transform.after(res);
        }
      }
      catch(e){}
      fn(null, res);
    };
  };
}
function prostrate ( source ) { return function ( method , transform ) { transform = transform || { } ; return function ( ) { var args = Array . prototype . slice . call ( arguments , 0 ) , fn = args . pop ( ) , res , last ; if ( args [ 0 ] && [ 'removeItem' , 'getItem' , 'setItem' ] . indexOf ( method ) > - 1 ) { var id = args [ 0 ] ; id = id . toString ( ) ; if ( id . indexOf ( module . exports . ns ) === - 1 ) { id = module . exports . ns + id ; } args [ 0 ] = id ; } if ( args . length == 2 && transform . before ) { args [ 1 ] = transform . before ( args [ 1 ] ) ; } if ( method === 'key' ) { assert ( typeof args [ 0 ] === 'number' , args [ 0 ] + ' must be a number' ) ; } if ( ! source [ method ] ) { throw new Error ( 'Unknown localstorage method ' + method ) ; } else { if ( source [ method ] . apply ) { res = source [ method ] . apply ( source , args ) ; debug ( 'result for ' + method , '(' , args , ')' , res ) ; } else { res = source [ method ] ; } } try { if ( transform . after ) { res = transform . after ( res ) ; } } catch ( e ) { } fn ( null , res ) ; } ; } ; }
Make local storage async, get and set JSON-ify.
Make local storage async get and set JSON - ify .