repacker
Repacks an object to another representation. Useful for preparation of data got from db.
Example:
var img = ; var abc = ; var result = abc;
will produce the following:
someField: 1 name: 'lala' img: url: 'about:blank' origSize: x: 5 y: 7
getSrcKeys()
Gets src keys corresponding to given dst keys:
abc;
will produce
'title' 'image_url' 'image_orig_width' 'image_orig_height' 'extra_field'
Subcomponents can also be used:
abc;
will produce
'image_url' 'image_orig_width'
reverse()
Performs an action reversed to repack()
abc
will produce:
extra_field: 'extra' title: 'lala' image_url: 'http://example.com/img.jpg'
multi
multi maps fields to several repackers, using field prefixes to choose a correct one:
var result = ;
will produce the following:
abc: name: 'title' xyz: w: 5 someField: 8 noPrefix: true
License
MIT