Guest User

Untitled

a guest
Dec 13th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. function getTags(entity) {
  2. return BPromise.resolve(items) // fetch database logic
  3. .then(function(tags) {
  4. console.log(tags, 'tags==================') // coming properly
  5. entity.tags = tags; // but assiagnment not working
  6. return entity;
  7. });
  8. }
  9.  
  10. data.map(item => {
  11. getTags(item).then(updatedItem => {
  12. console.log(updatedItem.tags) // prints ['tag1', 'tag2'] which is item.tags
  13. })
  14. })
Add Comment
Please, Sign In to add comment