Socket
Socket
Sign inDemoInstall

@ambassify/language-object

Package Overview
Dependencies
0
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.6 to 0.1.7

2

package.json
{
"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'
}
}
```
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc