I'm hoping to take advantage of underscore to avoid writing for
loops throughout my code base. I'm using map
in place of a for
loop like so:
body.tags = _.map(body.tags, function(tag) {
return {
id: tag.id,
userId: tag.userId,
createDate: tag.createDate,
tag: tag.tag.toLowerCase(),
};
});
My question is, is there a way to do this without specifying the properties that won't be changing (everything but tag
)? It seems like overkill to specify fields like id: tag.id
.