@ambassify/language-object
Advanced tools
Comparing version 0.1.6 to 0.1.7
{ | ||
"name": "@ambassify/language-object", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Detection and conversion library for language objects.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -100,1 +100,39 @@ # language-object | ||
``` | ||
### translate | ||
Takes in an object an selects only the language key that you would like to have selected. | ||
```js | ||
cast(sourceObject, [selectLanguage], [availableLanguages]) | ||
``` | ||
**Example:** | ||
```js | ||
const cast = require('@ambassify/language-object/translate'); | ||
const obj = { | ||
hi_nl: 'hallo', | ||
hi_en: 'hello', | ||
nested: { | ||
regular: 'key', | ||
value_nl: 'in dutch', | ||
value_en: 'in english' | ||
} | ||
}; | ||
translate(obj, 'en', ['en','nl']); | ||
``` | ||
Returns | ||
```js | ||
{ | ||
hi: 'hello', | ||
nested: { | ||
regular: 'key', | ||
value: 'in english' | ||
} | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17773
138