Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
object mapping
transform: {
sfjjr: 'stockbroker',
czdh: 'type'
}
const transform = (res) => {
if (_.isArray(res)) {
res.map(row => transform(row));
}
return _.reduce(_.keys(options.transform), (s, c) => {
s[options.transform[c]] = res[c];
return s;
}, {});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.