@dev-crew-berlin/enter-js-utils 0.10.7 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
- export * from './result';
2
- export * as theme from './theme';
3
- export * from './not-undefined';
4
1
  export * from './api-result';
5
2
  export * from './class-names';
3
+ export * from './not-undefined';
4
+ export * from './result';
5
+ export * as theme from './theme';
6
+ export * from './translate';
package/dist/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
+ export * from './api-result';
2
+ export * from './class-names';
3
+ export * from './not-undefined';
1
4
  export * from './result';
2
5
  export * as theme from './theme';
3
- export * from './not-undefined';
4
- export * from './api-result';
5
- export * from './class-names';
6
+ export * from './translate';
@@ -0,0 +1,2 @@
1
+ import { ReactNode } from 'react';
2
+ export declare function translate<T extends string | ReactNode>(text: string | Record<string, T>, language?: string): T;
@@ -0,0 +1,6 @@
1
+ export function translate(text, language) {
2
+ if (typeof text === 'string') return text;
3
+ const firstValue = text[Object.keys(text)[0]];
4
+ if (language === undefined) return firstValue;
5
+ return text[language] ?? firstValue;
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.10.7",
3
+ "version": "0.11.0",
4
4
  "description": "utils such as vaildation and other helpers to work with data from the enter app",
5
5
  "files": [
6
6
  "dist",