function wipeServer(collections) {
    let response;
    if (!collections) {
      // Strip the trailing slash.
      let res = this.resource(this.storageURL.slice(0, -1));
      res.setHeader("X-Confirm-Delete", "1");
      try {
        response = res.delete();
      } catch (ex) {
        this._log.debug("Failed to wipe server: " + CommonUtils.exceptionStr(ex));
        throw ex;
      }
      if (response.status != 200 && response.status != 404) {
        this._log.debug("Aborting wipeServer. Server responded with " +
                        response.status + " response for " + this.storageURL);
        throw response;
      }
      return response.headers["x-weave-timestamp"];
    }

    let timestamp;
    for (let name of collections) {
      let url = this.storageURL + name;
      try {
        response = this.resource(url).delete();
      } catch (ex) {
        this._log.debug("Failed to wipe '" + name + "' collection: " +
                        Utils.exceptionStr(ex));
        throw ex;
      }

      if (response.status != 200 && response.status != 404) {
        this._log.debug("Aborting wipeServer. Server responded with " +
                        response.status + " response for " + url);
        throw response;
      }

      if ("x-weave-timestamp" in response.headers) {
        timestamp = response.headers["x-weave-timestamp"];
      }
    }

    return timestamp;
  }
/**
   * Wipe user data from the server.
   *
   * @param collections [optional]
   *        Array of collections to wipe. If not given, all collections are
   *        wiped by issuing a DELETE request for `storageURL`.
   *
   * @return the server's timestamp of the (last) DELETE.
   */
Wipe user data from the server.
@param collections [optional]
Array of collections to wipe. If not given, all collections are
wiped by issuing a DELETE request for `storageURL`.

@return the server's timestamp of the (last) DELETE.
Wipe user data from the server . @param collections [ optional ] Array of collections to wipe . If not given all collections are wiped by issuing a DELETE request for ` storageURL ` . @return the server ' s timestamp of the ( last ) DELETE .
function wipeServer(collections) {
    let response;
    if (!collections) {
      let res = this.resource(this.storageURL.slice(0, -1));
      res.setHeader("X-Confirm-Delete", "1");
      try {
        response = res.delete();
      } catch (ex) {
        this._log.debug("Failed to wipe server: " + CommonUtils.exceptionStr(ex));
        throw ex;
      }
      if (response.status != 200 && response.status != 404) {
        this._log.debug("Aborting wipeServer. Server responded with " +
                        response.status + " response for " + this.storageURL);
        throw response;
      }
      return response.headers["x-weave-timestamp"];
    }
    let timestamp;
    for (let name of collections) {
      let url = this.storageURL + name;
      try {
        response = this.resource(url).delete();
      } catch (ex) {
        this._log.debug("Failed to wipe '" + name + "' collection: " +
                        Utils.exceptionStr(ex));
        throw ex;
      }
      if (response.status != 200 && response.status != 404) {
        this._log.debug("Aborting wipeServer. Server responded with " +
                        response.status + " response for " + url);
        throw response;
      }
      if ("x-weave-timestamp" in response.headers) {
        timestamp = response.headers["x-weave-timestamp"];
      }
    }
    return timestamp;
  }
function wipeServer ( collections ) { let response ; if ( ! collections ) { let res = this . resource ( this . storageURL . slice ( 0 , - 1 ) ) ; res . setHeader ( "X-Confirm-Delete" , "1" ) ; try { response = res . delete ( ) ; } catch ( ex ) { this . _log . debug ( "Failed to wipe server: " + CommonUtils . exceptionStr ( ex ) ) ; throw ex ; } if ( response . status != 200 && response . status != 404 ) { this . _log . debug ( "Aborting wipeServer. Server responded with " + response . status + " response for " + this . storageURL ) ; throw response ; } return response . headers [ "x-weave-timestamp" ] ; } let timestamp ; for ( let name of collections ) { let url = this . storageURL + name ; try { response = this . resource ( url ) . delete ( ) ; } catch ( ex ) { this . _log . debug ( "Failed to wipe '" + name + "' collection: " + Utils . exceptionStr ( ex ) ) ; throw ex ; } if ( response . status != 200 && response . status != 404 ) { this . _log . debug ( "Aborting wipeServer. Server responded with " + response . status + " response for " + url ) ; throw response ; } if ( "x-weave-timestamp" in response . headers ) { timestamp = response . headers [ "x-weave-timestamp" ] ; } } return timestamp ; }
Wipe user data from the server.
Wipe user data from the server .
// Strip the trailing slash.