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

chore: rename xf to transducerCreator #3088

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions source/internal/_dispatchable.js
Expand Up @@ -7,16 +7,17 @@ import _isTransformer from './_isTransformer.js';
* object in list position (last argument). If it is an array, executes [fn].
* Otherwise, if it has a function with one of the given method names, it will
* execute that function (functor case). Otherwise, if it is a transformer,
* uses transducer [xf] to return a new transformer (transducer case).
* uses transducer created by [transducerCreator] to return a new transformer
* (transducer case).
* Otherwise, it will default to executing [fn].
*
* @private
* @param {Array} methodNames properties to check for a custom implementation
* @param {Function} xf transducer to initialize if object is transformer
* @param {Function} transducerCreator transducer constructor if object is transformer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor nit. I would use factory here instead of constructor. This is not a constructor function (called with new), so I would avoid the word to avoid confusion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I have changed transducer constructor to transducer factory

* @param {Function} fn default ramda implementation
* @return {Function} A function that dispatches on object in list position
*/
export default function _dispatchable(methodNames, xf, fn) {
export default function _dispatchable(methodNames, transducerCreator, fn) {
return function() {
if (arguments.length === 0) {
return fn();
Expand All @@ -31,7 +32,7 @@ export default function _dispatchable(methodNames, xf, fn) {
idx += 1;
}
if (_isTransformer(obj)) {
var transducer = xf.apply(null, Array.prototype.slice.call(arguments, 0, -1));
var transducer = transducerCreator.apply(null, Array.prototype.slice.call(arguments, 0, -1));
return transducer(obj);
}
}
Expand Down