-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Make the invoker documentation a little more understandable to newbies like myself #2116
Conversation
src/invoker.js
Outdated
* | ||
* var sliceFrom = R.invoker(1, 'slice'); | ||
* // A function with one arguments |
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.
s/arguments/argument/
src/invoker.js
Outdated
* const firstCreditCardSection = invoker(2, "slice", 0, 4) | ||
* firstCreditCardSection("4242 4242 4242 4242") // => Function<...> | ||
* | ||
* // Instead you must immediately invoke the invoker (better wording tbd) |
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.
How about:
"Since invoker
returns a curried function, you may partially apply it to create the function you need."
Although these changes (with the suggestions from @buzzdecafe) are a definite improvement, I wonder if we shouldn't go further and stop lying with "Turns a named method ..." We do not start with a method/function, only with a name. And the same const indexOf = invoker(1, 'indexOf');
indexOf('bar', ['foo', 'bar', 'baz']); //=>1 (Array.prototype.indexOf)
indexOf('x', 'Supercalifragilisticexpialidocious'); //=> 21 (String,prototype.indexOf) I'm still not sure what the right phrasing is, but even with the proposed changes, this is still somewhat misleading. |
Changes made @buzzdecafe, but also feel free to make changes. |
@CrossEye is right, the first sentence of the existing documentation is misleading at best. How about: "Given a Number arity and a String method name, Is that better? 🤔 |
|
@krainboltgreene i think yours is definitely an improvement on mine |
@buzzdecafe Committed! |
src/invoker.js
Outdated
* | ||
* The returned function is curried and accepts `arity + 1` parameters where | ||
* the final parameter is the target object. | ||
* Given an `arity` (Number) and a `name` (String) the `invoker()` function |
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 think you can omit the parens after invoker
. Otherwise, this looks good to me.
There are some linting errors, but otherwise, this LGTM. 🐄 |
Summary of changes:
@ramda/ramda-docs Good to go? |
Actions already taken, user not active
No description provided.