# @schornio/map-object

> Map javascript objects by dot notation and other cool stuff

Latest version **1.2.2** (published 2015-05-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install @schornio/map-object
pnpm add @schornio/map-object
yarn add @schornio/map-object
bun add @schornio/map-object
```

## 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 | 1.2.2 |
| Published | 2015-05-06 |
| First published | 2015-04-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Thomas Schorn |
| Maintainers | schornio |
| Keywords | map, object, dot-notation, mapper |

## Links

- npm: https://www.npmjs.com/package/@schornio/map-object
- Repository: https://github.com/schornio/map-object
- Issues: https://github.com/schornio/map-object/issues
- npm.io page: https://npm.io/package/@schornio/map-object

## Dependencies (1)

- [async](https://npm.io/package/async.md) ^0.9.0

## Recent versions

- 1.2.2 (latest) — 2015-05-06
- 1.2.0 — 2015-05-05
- 1.2.1 — 2015-04-25

## README

# map-object

[![Build Status](https://travis-ci.org/schornio/map-object.svg)](https://travis-ci.org/schornio/map-object)

## Usage

### _constructor(map, options)

- `map`: map schema
- `options`: (optional) configuration
  - `strictMode`: error on unsuccessful mapping (default: ignore)
  - `context`: provide a context object

### prototype.map(obj, callback)

- `obj`: object to map
- `callback(error, obj)`: on mapping finished

### Map Schema

    {
      <string: destination name>: <string: source path>,
      <string: destination name>: <string: '$' + context source path>,
      <string: destination name>: <object: nested schema>
    }

### Example

    var MapObjLib = require('@schornio/map-object');

    var obj = {
      simpleProperty: 42,
      complexProperty: {
        child: 126
      }
    };

    var map = {
      flattern: 'complexProperty.child',
      explode: {
        child: 'simpleProperty'
      }
    };

    var objMap = new MapObjLib(map);
    objMap.map(obj, function(error, result) {
      /* result == {
        flattern: 126,
        explode: {
          child: 42
        }
      }*/
    });

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