-
Notifications
You must be signed in to change notification settings - Fork 3
Force a single link to an array if requested #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
hal.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you could do linkGroupPlus(self._links[link.rel], [link]) and get rid of the forceArray. This way you wouldn't even have to change implementation of linkGroupPlus.
|
Do you think we should handle the case where an array of links with different rels get passed ? |
|
Nevermind - been a long night :) PR coming. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two ternaries in the same expression are hard to follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe something like var links = (arguments.length === 1) ? link : extractLinks.apply(this, arguments);
and extractLinks would always receive two arguments. A relation and an href (or array of hrefs).
fixes #7