Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vocab/react

Package Overview
Dependencies
Maintainers
4
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vocab/react - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

6

CHANGELOG.md
# @vocab/react
## 0.0.8
### Patch Changes
- [`b51db12`](https://github.com/seek-oss/vocab/commit/b51db125b6d5e29feb77eac20a45b410e79be9b2) [#21](https://github.com/seek-oss/vocab/pull/21) Thanks [@jahredhope](https://github.com/jahredhope)! - Rename TranslationsProvider to VocabProvider
## 0.0.7

@@ -4,0 +10,0 @@

2

dist/declarations/src/index.d.ts

@@ -7,3 +7,3 @@ import { TranslationFile } from '@vocab/types';

}
export declare const TranslationsProvider: FunctionComponent<TranslationsValue>;
export declare const VocabProvider: FunctionComponent<TranslationsValue>;
export declare const useLanguage: () => Language;

@@ -10,0 +10,0 @@ declare type TranslationItem = {

@@ -12,3 +12,3 @@ 'use strict';

const TranslationsContext = /*#__PURE__*/React__default['default'].createContext(undefined);
const TranslationsProvider = ({
const VocabProvider = ({
children,

@@ -25,5 +25,9 @@ language

if (!context) {
throw new Error('Attempted to access translation without language set. Did you forget to render TranslationsProvider?');
throw new Error('Attempted to access translation without Vocab context set. Did you forget to render VocabProvider?');
}
if (!context.language) {
throw new Error('Attempted to access translation without language set. Did you forget to pass language to VocabProvider?');
}
return context.language;

@@ -35,2 +39,7 @@ };

const [, forceRender] = React.useReducer(s => s + 1, 0);
if (!translations[language]) {
throw new Error(`Translations does not include passed language "${language}". Translations include possible options ${Object.keys(translations)}`);
}
let translationsObject = translations[language].getValue();

@@ -40,3 +49,3 @@

if (SERVER_RENDERING) {
throw new Error('You should have preloaded this. Call Matt');
throw new Error(`Translations not syncronously available on server render. This should not happen.`);
}

@@ -70,4 +79,4 @@

exports.TranslationsProvider = TranslationsProvider;
exports.VocabProvider = VocabProvider;
exports.useLanguage = useLanguage;
exports.useTranslation = useTranslation;

@@ -12,3 +12,3 @@ 'use strict';

const TranslationsContext = /*#__PURE__*/React__default['default'].createContext(undefined);
const TranslationsProvider = ({
const VocabProvider = ({
children,

@@ -25,5 +25,9 @@ language

if (!context) {
throw new Error('Attempted to access translation without language set. Did you forget to render TranslationsProvider?');
throw new Error('Attempted to access translation without Vocab context set. Did you forget to render VocabProvider?');
}
if (!context.language) {
throw new Error('Attempted to access translation without language set. Did you forget to pass language to VocabProvider?');
}
return context.language;

@@ -35,2 +39,7 @@ };

const [, forceRender] = React.useReducer(s => s + 1, 0);
if (!translations[language]) {
throw new Error(`Translations does not include passed language "${language}". Translations include possible options ${Object.keys(translations)}`);
}
let translationsObject = translations[language].getValue();

@@ -40,3 +49,3 @@

if (SERVER_RENDERING) {
throw new Error('You should have preloaded this. Call Matt');
throw new Error(`Translations not syncronously available on server render. This should not happen.`);
}

@@ -70,4 +79,4 @@

exports.TranslationsProvider = TranslationsProvider;
exports.VocabProvider = VocabProvider;
exports.useLanguage = useLanguage;
exports.useTranslation = useTranslation;
import React, { useContext, useReducer } from 'react';
const TranslationsContext = /*#__PURE__*/React.createContext(undefined);
const TranslationsProvider = ({
const VocabProvider = ({
children,

@@ -16,5 +16,9 @@ language

if (!context) {
throw new Error('Attempted to access translation without language set. Did you forget to render TranslationsProvider?');
throw new Error('Attempted to access translation without Vocab context set. Did you forget to render VocabProvider?');
}
if (!context.language) {
throw new Error('Attempted to access translation without language set. Did you forget to pass language to VocabProvider?');
}
return context.language;

@@ -26,2 +30,7 @@ };

const [, forceRender] = useReducer(s => s + 1, 0);
if (!translations[language]) {
throw new Error(`Translations does not include passed language "${language}". Translations include possible options ${Object.keys(translations)}`);
}
let translationsObject = translations[language].getValue();

@@ -31,3 +40,3 @@

if (SERVER_RENDERING) {
throw new Error('You should have preloaded this. Call Matt');
throw new Error(`Translations not syncronously available on server render. This should not happen.`);
}

@@ -61,2 +70,2 @@

export { TranslationsProvider, useLanguage, useTranslation };
export { VocabProvider, useLanguage, useTranslation };
{
"name": "@vocab/react",
"version": "0.0.7",
"version": "0.0.8",
"main": "dist/vocab-react.cjs.js",

@@ -5,0 +5,0 @@ "module": "dist/vocab-react.esm.js",

@@ -56,9 +56,9 @@ # Vocab

```tsx
import { TranslationsProvider } from '@vocab/react';
import { VocabProvider } from '@vocab/react';
function App({ children }) {
return (
<TranslationsProvider language={language}>
<VocabProvider language={language}>
{children}
</TranslationsProvider>
</VocabProvider>
);

@@ -65,0 +65,0 @@ }

Sorry, the diff of this file is not supported yet

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