Socket
Book a DemoInstallSign in
Socket

kivra-copy-consumer

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kivra-copy-consumer

Allows a service to consume Kivra copy

1.0.3
latest
Source
npmnpm
Version published
Weekly downloads
3
Maintainers
5
Weekly downloads
 
Created
Source

Kivra copy consumer

Reusable copy consumption logic for Kivra frontend services

Get started

npm i --save kivra-copy-consumer
import { fetchCopy } from 'kivra-copy-consumer'

fetchCopy({
  'en-US': 'https://example.com/us-copy.json'
},
{
  useBrowserLocale: true,
  fallbackLocale: 'en-US',
  defaultCopyPath: '/copy-default.json'
}).then(copy => {
  // use copy ...
})

Which locale is used?

In order of prioritization:

  • if locale GET param is set in URL, copy is fetched for that locale
  • if useBrowserLocale is true, use locale prefered by browser
  • otherwise use fallbackLocale

Which file is fetched

  • If an url for the chosen locale was passed then that is fetched. If the fetch fails we instead fetch defaultCopyPath.
  • If no url for the chosen locale was passed then the url for fallbackLocale is fetched

FAQs

Package last updated on 01 Nov 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.