mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Convert methods not found in aryMethod mapping.
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user