1.0.3 • Published 1 year ago
@loraayanz/object-mapper v1.0.3
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-mapperExample
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'
}
};