# i18n-map-resolver

> resolves objects with i18n maps inside them even if deeply

Latest version **2.0.2** (published 2018-02-15) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install i18n-map-resolver
pnpm add i18n-map-resolver
yarn add i18n-map-resolver
bun add i18n-map-resolver
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2018-02-15 |
| First published | 2016-06-01 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 27.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | dirwin517 |
| Maintainers | dirwin517 |
| Keywords | i18n, map, resolve, deep, localize, string |

## Links

- npm: https://www.npmjs.com/package/i18n-map-resolver
- Repository: https://github.com/arupex/i18n-map-resolver
- Homepage: https://github.com/arupex/i18n-map-resolver#readme
- Issues: https://github.com/arupex/i18n-map-resolver/issues
- npm.io page: https://npm.io/package/i18n-map-resolver

## Dependencies (1)

- [deep-value](https://npm.io/package/deep-value.md) ^1.0.4

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 2.0.2 (latest) — 2018-02-15
- 2.0.1 — 2018-01-27
- 2.0.0 — 2018-01-26
- 1.1.0 — 2017-10-25
- 1.0.3 — 2016-06-14
- 1.0.2 — 2016-06-14
- 1.0.1 — 2016-06-10
- 1.0.0 — 2016-06-01

## README

# i18n-map-resolver
Resolves i18n Maps inside deep objects

[![npm version](https://badge.fury.io/js/i18n-map-resolver.svg)](https://badge.fury.io/js/i18n-map-resolver) [![dependencies](https://david-dm.org/arupex/i18n-map-resolver.svg)](http://github.com/arupex/i18n-map-resolver) ![Build Status](https://api.travis-ci.org/arupex/i18n-map-resolver.svg?branch=master) <a href='https://pledgie.com/campaigns/31873'><img alt='Pledge To Arupex!' src='https://pledgie.com/campaigns/31873.png?skin_name=chrome' border='0' ></a>

Install:

    npm install i18n-map-resolver --save


Example:

    var ResolverFactory = require('i18n-map-resolver');

    var input = {
        randomField : 'random',
        label : {
            en_US : 'English 1',
            es_VE : 'Spanish 1',
            nb_NO : 'Norwegian 1'
        },
        label1 : {
            en_US : 'English 2',
            es_VE : 'Spanish 2',
            nb_NO : 'Norwegian 2'
        },
        randomObject : {
            aValue : 'value',
            aTest : 'test'
        },
        number : 7,
        array : [
            {
                label : {
                    en_US : 'English Inner',
                    es_VE : 'Spanish Inner',
                    nb_NO : 'Norwegian Inner'
                }
            }
        ]
    };

    var options = {};
    /*
     *  availible options include
     *      fallbackMethod : function (key, value, locale, fallback)
     *      detectorMethod : function (key, value)
     *      fallbackLocale : string
     *      decoratorMethod : function(object, key, value, locale, fallback),
     *      maxDepth : number (helps if object has cycle)
     *      report : boolean - whether to report fallbacks and such
    */

    var resolver = new ResolverFactory(options);
    console.log(JSON.stringify(resolver.resolve(input), null, 3);

Expected Output:

    {
        randomField: 'random',
        label: 'English 1',
        label1: 'English 2',
        randomObject: { aValue: 'value', aTest: 'test' },
        number : 7,
        array : [
            {
                label : 'English Inner'
            }
        ]
    });

For More Examples:

    test/test.js

---
_Source: https://npm.io/package/i18n-map-resolver · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
