lib/LocalStorage.js
function LocalStorage (params) {
  events.EventEmitter.call(this);

  if (!params || typeof params === 'string') {
    params = {
      ns: params || ''
    };
  }

  this.ns = params.ns || '';

  if (typeof this.ns !== 'string') {
    throw new Error('Namespace must be a string.');
  }

  this.preSave = params.preSave || defProcessor;
  this.postLoad = params.postLoad || defProcessor;

  if (this.preSave && typeof this.preSave !== 'function') {
    throw new Error('preSave option must be a function');
  }

  if (this.postLoad && typeof this.postLoad !== 'function') {
    throw new Error('postLoad option must be a function');
  }

  this.EVENTS = EVENTS;
}
function LocalStorage (params) {
  events.EventEmitter.call(this);

  if (!params || typeof params === 'string') {
    params = {
      ns: params || ''
    };
  }

  this.ns = params.ns || '';

  if (typeof this.ns !== 'string') {
    throw new Error('Namespace must be a string.');
  }

  this.preSave = params.preSave || defProcessor;
  this.postLoad = params.postLoad || defProcessor;

  if (this.preSave && typeof this.preSave !== 'function') {
    throw new Error('preSave option must be a function');
  }

  if (this.postLoad && typeof this.postLoad !== 'function') {
    throw new Error('postLoad option must be a function');
  }

  this.EVENTS = EVENTS;
}
function LocalStorage ( params ) { events . EventEmitter . call ( this ) ; if ( ! params || typeof params === 'string' ) { params = { ns : params || '' } ; } this . ns = params . ns || '' ; if ( typeof this . ns !== 'string' ) { throw new Error ( 'Namespace must be a string.' ) ; } this . preSave = params . preSave || defProcessor ; this . postLoad = params . postLoad || defProcessor ; if ( this . preSave && typeof this . preSave !== 'function' ) { throw new Error ( 'preSave option must be a function' ) ; } if ( this . postLoad && typeof this . postLoad !== 'function' ) { throw new Error ( 'postLoad option must be a function' ) ; } this . EVENTS = EVENTS ; }
Class used to provide a wrapper over localStorage
@param {String} [ns] Optional namespace for the adpater.
Class used to provide a wrapper over localStorage