Skip to content
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

`orderBy` documentation #4668

Open
Crisfole opened this issue Feb 20, 2020 · 1 comment
Open

`orderBy` documentation #4668

Crisfole opened this issue Feb 20, 2020 · 1 comment

Comments

@Crisfole
Copy link

@Crisfole Crisfole commented Feb 20, 2020

It works (currently) to pass a single string, function, or object as the iteratees, and a single string for 'asc' or 'desc' like so:

const sorted = orderBy(unsorted, 'property', 'desc');

This is undocumented. Either this shortcut should be documented somehow, or it should fail. I vote documented.

Coincidentally, I'm unsure how using an object as an iteratee would work, but I'd love to learn (without having to read the source, which is what I'm about to do anyway). Adding top level documentation on the ways iteratees work would be nice...Actually, how having poked through the actual code I'm still unclear how that's legal.

@Jock924491
Copy link

@Jock924491 Jock924491 commented Mar 15, 2020

Agreed, none of the iteratee shorthand usages are documented in the jsdoc.

Currently the values are
@param {Function} [predicate=_.identity] The function invoked per iteration.

Where it would make more sense to be something like.
@param {Function|String|object|[]} [predicate=_.identity] The function invoked per iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.