Convert methods not found in aryMethod mapping.

This commit is contained in:
John-David Dalton
2016-04-02 22:49:17 -07:00
parent 6861734010
commit 69ce7cde7d

View File

@@ -310,7 +310,7 @@ function baseConvert(util, name, func, options) {
}
var _ = func;
// Iterate over methods for the current ary cap.
// Convert methods by ary cap.
var pairs = [];
each(aryMethodKeys, function(aryKey) {
each(mapping.aryMethod[aryKey], function(key) {
@@ -321,6 +321,19 @@ function baseConvert(util, name, func, options) {
});
});
// Convert remaining methods.
each(keys(_), function(key) {
if (typeof _[key] == 'function') {
var length = pairs.length;
while (length--) {
if (pairs[length][0] == key) {
return;
}
}
pairs.push([key, wrap(key, _[key])]);
}
});
// Assign to `_` leaving `_.prototype` unchanged to allow chaining.
each(pairs, function(pair) {
_[pair[0]] = pair[1];
@@ -330,7 +343,7 @@ function baseConvert(util, name, func, options) {
if (setPlaceholder) {
_.placeholder = placeholder;
}
// Reassign aliases.
// Assign aliases.
each(keys(_), function(key) {
each(mapping.realToAlias[key] || [], function(alias) {
_[alias] = _[key];