Socket
Socket
Sign inDemoInstall

@nuskin/ns-util

Package Overview
Dependencies
Maintainers
5
Versions
1730
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuskin/ns-util


Version published
Weekly downloads
525
increased by43.44%
Maintainers
5
Weekly downloads
 
Created
Source

ns-util

Kindly add a basic usage here after you've created a utility.

Equinox Local Storage Usage

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

  • my-site
  • my-site-home
  • ns-product
  • Add your project if you're using Equinox Local Storage
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.
 *
 * @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.
 * 
 * @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.
 *
 * @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.
 *
 * output: true | false
 */
const isEnabledMarketsSaved = equinoxLocalStorage.setEnabledMarkets({
    ca: { name: 'Canada', storeID: '423' },
    us: { name: 'United States', storeID: '422' }
});

Tags

#equinox #localstorage

FAQs

Package last updated on 23 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc