Skip to content
This repository has been archived by the owner on Nov 16, 2018. It is now read-only.

Commit

Permalink
Adding some documentation about how fetching embedded resources works
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Grill committed Aug 3, 2016
1 parent e071b56 commit 5032fa5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/waterwheel.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,12 @@ module.exports = class Waterwheel extends Request {
});
});

// Create a Set from the possibly-duplicate links array.
// Get an array from that set.
links = Array.from(new Set(links));

// Promise.all accepts an array of promises to resolve. The first item
// in this array is the original entity, adjacent to the embedded ones.
return Promise.all([Promise.resolve(entityJSON)].concat(links.map(link => this.issueRequest(methods.get, link))));
}

Expand Down

0 comments on commit 5032fa5

Please sign in to comment.