# @nuskin/ns-util

> ## Contentstack Contentstack GraphQL calls.

Latest version **4.10.0** (published 2026-02-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install @nuskin/ns-util
pnpm add @nuskin/ns-util
yarn add @nuskin/ns-util
bun add @nuskin/ns-util
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.10.0 |
| Published | 2026-02-16 |
| First published | 2018-04-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 360 KB |
| Known vulnerabilities | 0 (+6 in 3 direct dependencies) |
| Install scripts | no |
| Author | Ian Harisay |
| Maintainers | nkranendonk, emoore, nuskin-cws, klau, rellenberger, akshay263, nishalk, aallani |

## Links

- npm: https://www.npmjs.com/package/@nuskin/ns-util
- Repository: git@code.tls.nuskin.io:ns-am/nu-skin-aem/wm/ns-util
- Homepage: https://code.tls.nuskin.io/ns-am/nu-skin-aem/wm/ns-util/blob/master/README.md
- npm.io page: https://npm.io/package/@nuskin/ns-util

## Dependencies (8)

- [lodash](https://npm.io/package/lodash.md) 4.17.21
- [moment](https://npm.io/package/moment.md) 2.29.4
- [@nuskin/events](https://npm.io/package/@nuskin/events.md) 1.0.4
- [moment-timezone](https://npm.io/package/moment-timezone.md) 0.5.31
- [broadcast-channel](https://npm.io/package/broadcast-channel.md) 3.1.0
- [@nuskin/nuskinjquery](https://npm.io/package/@nuskin/nuskinjquery.md) 2.3.1
- [@nuskin/ns-common-lib](https://npm.io/package/@nuskin/ns-common-lib.md) 1.4.6
- [string.prototype.startswith](https://npm.io/package/string.prototype.startswith.md) 0.2.0

## Recent versions

- 4.10.0 (latest) — 2026-02-16
- 4.10.1-comx-1477.1 (prerelease) — 2026-07-28
- 2.29.0-alpha.1466 (canary) — 2019-10-11
- 4.10.1-it-27127.1 — 2026-05-13
- 4.9.0 — 2026-02-09
- 4.9.0-pa-1059.1 — 2026-02-06
- 4.9.0-mdigi-7127.1 — 2026-01-01
- 4.8.1 — 2025-12-10
- 4.9.0-pa-902.1 — 2025-10-09
- 4.8.0 — 2025-10-03
- 4.7.3-pa-902.2 — 2025-10-03
- 4.7.3-pa-902.1 — 2025-10-03
- 4.8.0-pa-198.1 — 2025-10-02
- 4.8.0-mdigi-6056.1 — 2025-08-11
- 4.8.0-mdigi-2901.1 — 2025-04-29
- … 1734 more at https://npm.io/package/@nuskin/ns-util/versions

## README

# ns-util
#### *Kindly add a basic usage here after you've created a utility.*

## Contentstack
Contentstack GraphQL calls.

```js
import { contentstackService, util } from '@nuskin/ns-util';

/**
 * getAEMConfig fetches the market config from contentstack.
 * It will return null if an error occurs.
 *
 * @output null | {
 *   aws_url: "https://aws.test-url.com",
 *   checkout_client_id: "client-id",
 *   checkout_client_secret: "client-secret"
 * }
 */
const aemConfig = await contentstackService.getAEMConfig();

/**
 * getEquinoxMarkets will get the list of Equinox-enabled markets from contentstack.
 *
 * @output null | [
 *   {
 *     country_code: "CA",
 *     market_name: "Canada",
 *     store_id: "407"
 *   },
 *   {
 *     country_code: "US",
 *     market_name: "United States",
 *     store_id: "406"
 *   }
 * ]
 */
const markets = await contentstackService.getEquinoxMarkets();

/**
 * isMarketEnabled checks is the given market is in the list
 * of equinox-enabled markets. It will return the market if found.
 * Otherwise, returns null.
 *
 * @output null | {
 *   country_code: "CA",
 *   market_name: "Canada",
 *   store_id: "407"
 * }
 */
const market = await contentstackService.isMarketEnabled(util.countryCode);
```


## Equinox Local Storage Usage
Equinox Local Storage utilities. It is used in the following projects:

**Note:** deprecated functions will be removed in the next major release.

```js
import { equinoxLocalStorage } from '@nuskin/ns-util';

/**
 * getEnabledMarkets gets the list of enabled markets.
 * Returns an object of MarketList if found. Otherwise,
 * it will return null.
 *
 * @deprecated Use contentstack.getEquinoxMarkets
 * @output null | {
 *   ca: { name: 'Canada', storeID: '423' },
 *   us: { name: 'United States', storeID: '422' }
 * }
 */
const markets = equinoxLocalStorage.getEnabledMarkets();

/**
 * getMarket gets a specific market from the list of equinox-enabled markets.
 * Returns an object of Market if found.
 *
 * @deprecated Use contentstack.isMarketEnabled
 * @output { name: 'United States', storeID: '422' }
 */
const market = equinoxLocalStorage.getMarket('us');

/**
 * isEquinoxEnabled checks if the `isEquinoxEnabled` is in localstorage
 * and the value is set to true.
 *
 * @output true | false
 */
const isEquinoxEnabled = equinoxLocalStorage.isEquinoxEnabled();

/**
 * isMarketEnabled checks if the argument is in the list of enabled markets
 * AND `isEquinoxEnabled` is set to true in localstorage.
 *
 * @deprecated Use contentstack.isMarketEnabled
 * @output true | false
 */
const isMarketEnabled = equinoxLocalStorage.isMarketEnabled('us');

/**
 * setEnabledMarkets saves the value in local storage.
 * Returns a boolean that indicates whether the task is successful.
 *
 * @deprecated There is no need to set this locally
 * @output true | false
 */
const isEnabledMarketsSaved = equinoxLocalStorage.setEnabledMarkets({
    ca: { name: 'Canada', storeID: '423' },
    us: { name: 'United States', storeID: '422' }
});
```
## Tags
\#contentstack \#equinox \#graphql \#localstorage

---
_Source: https://npm.io/package/@nuskin/ns-util · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
