Skip to content

philipdev/obj2obj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

obj2obj

Utility to transform JavaScript object properties

Example 1

var transform = require('obj2obj');
var src = { 
	a:'X', 
	b:'Y', 
	c:'Z'
};
var template = { 'a':'x', 'b':'y', 'c': 'z' };

console.log( transform(template, src) );

Outputs: { x: 'X', y: 'Y', z: 'Z' }

Example 2

var transform = require('obj2obj');
var src = { 
	from:[{ a:1, b:9},{ a:2, b:10}]
};
var template = { 'from.*.a': 'a.*',  'from.*.b': 'b.*'};

console.log( transform(template, src) );

About

js object mapping utility

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published