export const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
export const stringContainsJson = (str) => {
  let parsedJson;
  try {
    // attempt to parse JSON object from provided string
    parsedJson = JSON.parse(str);
  }
  catch (err) {
    // not a valid JSON string
    return false;
  }
  return typeof parsedJson === "object" && parsedJson !== null;
};
export const defer = () => {
  let res;
  let rej;
  let promise = new Promise((resolve, reject) => {
    res = resolve;
    rej = reject;
  });
  promise.resolve = res;
  promise.reject = rej;
  return promise;
};
//# sourceMappingURL=utils.js.map
