Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getTags(entity) {
- return BPromise.resolve(items) // fetch database logic
- .then(function(tags) {
- console.log(tags, 'tags==================') // coming properly
- entity.tags = tags; // but assiagnment not working
- return entity;
- });
- }
- data.map(item => {
- getTags(item).then(updatedItem => {
- console.log(updatedItem.tags) // prints ['tag1', 'tag2'] which is item.tags
- })
- })
Add Comment
Please, Sign In to add comment