<h1 align="center">DSC JS Utils—Isomorphic Utility Scripts</h1>
<h5 align="center">Isomorphic JS utility scripts that work within a browser or Node</h5>

---

<p align="center">
  <a href="https://github.com/dollarshaveclub/js-utils/#folders">Folders</a>&nbsp;&nbsp;
  <a href="https://github.com/dollarshaveclub/js-utils/#usage">Usage</a>&nbsp;&nbsp;
  <a href="https://github.com/dollarshaveclub/js-utils/#analytics">Analytics</a>&nbsp;&nbsp;
  <a href="https://github.com/dollarshaveclub/js-utils/#publishing">Publishing</a>&nbsp;&nbsp;
  <a href="https://github.com/dollarshaveclub/js-utils/tree/master/browser/README.md">Browser Docs</a>&nbsp;&nbsp;
   <a href="https://github.com/dollarshaveclub/js-utils/">Back</a>
</p>

---

## Isomorphic Scripts

The files listed below are scripts located within the [isomorphic folder](https://github.com/dollarshaveclub/js-utils/tree/master/isomorphic) of this repository. They're meant for being used within a web browser.

---

- **`config.js`**
  - exports json configs (like zip code)
- **`get-image-url.js`**
  - get an image url from a Contentful CMS image file or any image url, taking into account whether it's an SVG or an Imgix URL and automatically optimizing
- **`poll-for-conditions.js`**
  - waits for data
- **`product-helpers.js`**
  - product helpers
- **`resolve-api-url.js`**
  - resolves DSC urls for both shops and other applications like _try_ and _help_ pages
- **`resolve-environment.js`**
  - resolves environments like development or production
- **`resolve-ketone-host.js`**
  - gives a ketone server hostname
- **`resolve-shop-code.js`**
  - resolve international country shop codes
- **`sleep.js`**
  - resolves promise after time
- **`switch-shop-from-hostname.js`**
  - switches shop code based on the hostname
- **`unwind-dimensions.js`**
  - adds the appropriate shop code with routes
