automapper
v1.0.0
Published
Automapper clone to js world, used with nodejs
Downloads
888
Maintainers
Readme
Automapper clone for NodeJs
License goes to
http://johnkalberer.com/?p=47
Usage
1- Require mapper module
const mapper = require('automapper');
2- Define mapping
mapper.createMap("body", "user")
.forMember("userName", function () { this.mapFrom("username"); });
3- Using mapper
//could be actual body from req object
var body = {
username: 'ahmed'
};
var user = {
userName: null
};
mapper.map("body", "user", body, user);
now user.userName has the value 'ahmed'