mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +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;
|
var _ = func;
|
||||||
|
|
||||||
// Iterate over methods for the current ary cap.
|
// Convert methods by ary cap.
|
||||||
var pairs = [];
|
var pairs = [];
|
||||||
each(aryMethodKeys, function(aryKey) {
|
each(aryMethodKeys, function(aryKey) {
|
||||||
each(mapping.aryMethod[aryKey], function(key) {
|
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.
|
// Assign to `_` leaving `_.prototype` unchanged to allow chaining.
|
||||||
each(pairs, function(pair) {
|
each(pairs, function(pair) {
|
||||||
_[pair[0]] = pair[1];
|
_[pair[0]] = pair[1];
|
||||||
@@ -330,7 +343,7 @@ function baseConvert(util, name, func, options) {
|
|||||||
if (setPlaceholder) {
|
if (setPlaceholder) {
|
||||||
_.placeholder = placeholder;
|
_.placeholder = placeholder;
|
||||||
}
|
}
|
||||||
// Reassign aliases.
|
// Assign aliases.
|
||||||
each(keys(_), function(key) {
|
each(keys(_), function(key) {
|
||||||
each(mapping.realToAlias[key] || [], function(alias) {
|
each(mapping.realToAlias[key] || [], function(alias) {
|
||||||
_[alias] = _[key];
|
_[alias] = _[key];
|
||||||
|
|||||||
Reference in New Issue
Block a user