var canonical = {
'transaction': ['tx', 'trans'],
'address': ['addrText', 'addr']
}
var a = {
"transaction": { "id": "2"},
"addr": "12345",
"transmit": true
}
var b = {
"tx": { "id": "9"},
"addrText": "95645"
}
var xlat = require('xlat')(canonical)
console.log(xlat.translate(a))
console.log(xlat.translate(a, [a, b]))
// lets update dictionary
var addendum = { 'send': ['transmit'] }
xlat.index(addendum)
console.log(xlat.translate(a))
-
Notifications
You must be signed in to change notification settings - Fork 0
Translate object from one set of keys to another
License
leverj/xlat
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Translate object from one set of keys to another
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published