Idiomatic way to check for the existence of LocalStorage
See https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#Testing_for_availability
@param type
@return {boolean}
976705
function isStorageAvailable() {
  var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LOCAL_STORAGE;
  var storage;

  try {
    storage = window[type];
    var x = STORAGE_TEST;
    storage.setItem(x, x);
    storage.removeItem(x);
    return true;
  } catch (e) {
    return e instanceof DOMException && (e.code === ERROR_CODE.NOT_FIREFOX || // Everything except Firefox
    e.code === ERROR_CODE.FIREFOX || // Firefox
    e.name === ERROR_TYPE.QUOTA_EXCEEDED_ERROR || // Everything except Firefox
    e.name === ERROR_TYPE.NS_ERROR_DOM_QUOTA_REACHED) && // Firefox
    storage.length !== 0;
  }
}
96386
static StorageLocationType getType(StorageDirectory sd) {
    if ((sd instanceof NNStorageDirectory)) {
      return ((NNStorageDirectory) sd).type;
    } 
    // by default all are local
    return StorageLocationType.LOCAL;
  }
651114
public static boolean isPrivateInnerType(TypeElement type) {
    switch (type.getNestingKind()) {
      case ANONYMOUS:
      case LOCAL:
        return true;
      case MEMBER:
        return isPrivate(type) || isPrivateInnerType((TypeElement) type.getEnclosingElement());
      case TOP_LEVEL:
        return isPrivate(type);
    }
    throw new AssertionError("Unknown NestingKind");
  }
178722
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;
}
68378
function isInternalComponentType(type) {
  return (
    typeof type === 'function' &&
    typeof type.prototype !== 'undefined' &&
    typeof type.prototype.mountComponent === 'function' &&
    typeof type.prototype.receiveComponent === 'function'
  );
}
513874
function StorageHandle() {
  this.storageSupport = storageSupportAnalyse();
  switch (this.storageSupport) {
    case 0:
      var exec = require('cordova/exec');
      this.storageHandlerDelegate = exec;
      break;
    case 1:
      var localStorageHandle = require('./LocalStorageHandle');
      this.storageHandlerDelegate = localStorageHandle;
      break;
    case 2:
      console.log("ALERT! localstorage isn't supported");
      break;
    default:
      console.log("StorageSupport Error");
      break;
  }
}
1310714
function(store, type, snapshot) {
        var data = this._serializeData(store, type, snapshot);

        return this.ajax(this.buildURL(type.modelName), 'POST', {
          data: data
        });
      }
19525
function PersistentStorage(namespace, override) {
  this.prefix = ['__', namespace, '__'].join('');
  this.ttlKey = '__ttl__';
  this.keyMatcher = new RegExp('^' + _.escapeRegExChars(this.prefix));

  // for testing purpose
  this.ls = override || LOCAL_STORAGE;

  // if local storage isn't available, everything becomes a noop
  !this.ls && this._noop();
}
406739
function() {
            try {
                return (typeof window.localStorage === 'undefined')? null : window.localStorage;
            } catch (e) {
                logging.error("Error accessing localStorage: ", e);
                return null;
            }
        }
867617
function () {

      if (!browserSupportsLocalStorage) {
        $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED');
        return false;
      }

      var prefixLength = prefix.length;
      var keys = [];
      for (var key in webStorage) {
        // Only return keys that are for this app
        if (key.substr(0,prefixLength) === prefix) {
          try {
            keys.push(key.substr(prefixLength));
          } catch (e) {
            $rootScope.$broadcast('LocalStorageModule.notification.error', e.Description);
            return [];
          }
        }
      }
      return keys;
    }
777578
function LocalStore (options) {
  options = options || {};

  options.max = Number(options.max);
  if (isNaN(options.max)) options.max = DEFAULT_MAX;
  this._max = options.max;

  options.gcProbability = Number(options.gcProbability);
  if (isNaN(options.gcProbability)) options.gcProbability = DEFAULT_PROBABILITY;
  this._gcProbability = options.gcProbability;

  options.path = options.path || DEFAULT_PATH;
  this._path = options.path;

  options.type = options.type || DEFAULT_TYPE;
  this._type = options.type;
  this._storage = getStorage(this._type, this._path);

  options.prefix = options.prefix || DEFAULT_PREFIX;
  this._prefix = options.prefix;

  debug('init: type=%s, prefix=%s, path=%s, max=%s, gcProbability=%s', this._type, this._prefix, this._path, this._max, this._gcProbability);

  this._setKeyTotal(this._itemLength());
  debug('keyTotal=%s', this._getKeyTotal());

  return this;
}
598345
function Provider(storage) {
  Object.defineProperties(this, {

    /**
     * The provider storage.
     *
     * @property storage
     * @type Storage
     * @final
     */
    storage: {value: storage}

  });

  if (!(this.storage instanceof Storage))
    throw new TypeError('storage must be of type Storage');
}
123397
static boolean isPreferred(StorageLocationType type, StorageDirectory sd) {
    if ((sd instanceof NNStorageDirectory)) {
      return ((NNStorageDirectory) sd).type == type;
    } 
    // by default all are preferred
    return true;
  }
651268
public static boolean hasOuterContext(TypeElement type) {
    switch (type.getNestingKind()) {
      case ANONYMOUS:
      case LOCAL:
        return !isStatic(type.getEnclosingElement());
      case MEMBER:
        return !isStatic(type);
      case TOP_LEVEL:
        return false;
    }
    throw new AssertionError("Unknown NestingKind");
  }
490807
function (key) {
      if (!browserSupportsLocalStorage || self.storageType === 'cookie') {
        if (!browserSupportsLocalStorage) {
          $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED');
        }

        if (notify.removeItem) {
          $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: 'cookie'});
        }
        return removeFromCookies(key);
      }

      try {
        webStorage.removeItem(deriveQualifiedKey(key));
        if (notify.removeItem) {
          $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: self.storageType});
        }
      } catch (e) {
        $rootScope.$broadcast('LocalStorageModule.notification.error', e.message);
        return removeFromCookies(key);
      }
      return true;
    }
679440
public function exists($type)
    {
        foreach ($this->loaders as $loader) {
            if ($loader->exists($type)) {
                return true;
            }
        }

        return false;
    }
135721
public static boolean mightContainsProperties(Class<?> type) {
    return type != Object.class
        && type != String.class
        && type != Date.class
        && type != Calendar.class
        && !Primitives.isPrimitive(type)
        && !Iterables.isIterable(type)
        && !Types.isGroovyType(type);
  }