0.0.2 • Published 8 years ago

mapifier v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Mapifier module

Transform objects in a breeze

Install

$ npm install mapifier

Description

This module provides an easy way to transform objects between two structures. You provide a mapping configuration and can then send objects through and get them the way you want. With one config you are also able to transform the object back to the original structure.

Example

const Mapifier = require('mapifier');

const mapifier = new Mapifier({
  'sourceProperty' : 'destinationProperty',
  'deep.property': 'another.deep.property',
})

const newObject = mapifier.transform({
  sourceProperty: 'I were a source property',
  deep: {
    property: 'I were a deep property',
  },
});

// newObject is  { destinationProperty: 'I were a source property', another: { deep: { property: 'I were a deep property' } } }

const oldObject = mapifier.transformBack(newObject);

// oldObject is { sourceProperty: 'I were a source property', deep: { property: 'I were a deep property' } }
0.0.2

8 years ago

0.0.1

8 years ago