1.0.3 • Published 1 year ago

@loraayanz/object-mapper v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Object Mapper

A simple and efficient NPM package to map a given object into a specified object structure. This package allows you to transform data easily, making it ideal for applications that require data normalization or restructuring.

Installation

You can install the package using npm:

npm i @loraayanz/object-mapper

Example

const mapper = require("@loraayanz/object-mapper");

// Define your source object
const src = {
    name: 'John Doe',
    age: 30,
    address: {
        street: '123 Main St',
        city: 'Anytown',
        zip: '12345'
    }
};

// Define the desired object structure
const proto = {
    name: null,
    age: null,
    address: {
        zip: null
    }
};

mapper(proto, src);

// Result

{
    name: 'John Doe',
    age: 30,
    address: {
        zip: '12345'
    }
};
1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago