lib/JsonIndex.js
function (indexName, key) {
    return new Promise((resolve, reject) => {
      if (index[indexName]) {
        resolve(index[indexName][key] || null);
      } else {
        debug("opening index %s", indexName);
        storage.openIndex(indexName).then(index => {
          index[indexName] = index;
          resolve(index[indexName][key] || null);
        });
      }
    });
  }
function (indexName, key) {
    return new Promise((resolve, reject) => {
      if (index[indexName]) {
        resolve(index[indexName][key] || null);
      } else {
        debug("opening index %s", indexName);
        storage.openIndex(indexName).then(index => {
          index[indexName] = index;
          resolve(index[indexName][key] || null);
        });
      }
    });
  }
function ( indexName , key ) { return new Promise ( ( resolve , reject ) => { if ( index [ indexName ] ) { resolve ( index [ indexName ] [ key ] || null ) ; } else { debug ( "opening index %s" , indexName ) ; storage . openIndex ( indexName ) . then ( index => { index [ indexName ] = index ; resolve ( index [ indexName ] [ key ] || null ) ; } ) ; } } ) ; }
Returns an item from the index.
@param {String} indexName Name of the index to query. Cannot be null.
@param {String} key Unique key of the required item. Cannot be null.
Returns an item from the index .