src/videoCache.js
function shimStorageCallback(done) {
  return {
    success: function(responseBody) {
      let ids;
      try {
        ids = JSON.parse(responseBody).responses
      } catch (e) {
        done(e, []);
        return;
      }

      if (ids) {
        done(null, ids);
      } else {
        done(new Error("The cache server didn't respond with a responses property."), []);
      }
    },
    error: function(statusText, responseBody) {
      done(new Error(`Error storing video ad in the cache: ${statusText}: ${JSON.stringify(responseBody)}`), []);
    }
  }
}
function shimStorageCallback(done) {
  return {
    success: function(responseBody) {
      let ids;
      try {
        ids = JSON.parse(responseBody).responses
      } catch (e) {
        done(e, []);
        return;
      }

      if (ids) {
        done(null, ids);
      } else {
        done(new Error("The cache server didn't respond with a responses property."), []);
      }
    },
    error: function(statusText, responseBody) {
      done(new Error(`Error storing video ad in the cache: ${statusText}: ${JSON.stringify(responseBody)}`), []);
    }
  }
}
function shimStorageCallback ( done ) { return { success : function ( responseBody ) { let ids ; try { ids = JSON . parse ( responseBody ) . responses } catch ( e ) { done ( e , [ ] ) ; return ; } if ( ids ) { done ( null , ids ) ; } else { done ( new Error ( "The cache server didn't respond with a responses property." ) , [ ] ) ; } } , error : function ( statusText , responseBody ) { done ( new Error ( ` ${ statusText } ${ JSON . stringify ( responseBody ) } ` ) , [ ] ) ; } } }
A function which should be called with the results of the storage operation.

@callback videoCacheStoreCallback

@param {Error} [error] The error, if one occurred.
@param {?string[]} uuids An array of unique IDs. The array will have one element for each bid we were asked
to store. It may include null elements if some of the bids were malformed, or an error occurred.
Each non-null element in this array is a valid input into the retrieve function, which will fetch
some VAST XML which can be used to render this bid's ad.
 
A function which bridges the APIs between the videoCacheStoreCallback and our ajax function's API.

@param {videoCacheStoreCallback} done A callback to the "store" function.
@return {Function} A callback which interprets the cache server's responses, and makes up the right
arguments for our callback.
A function which should be called with the results of the storage operation .