mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Ensure fp convert can work with aliases as name.
This commit is contained in:
@@ -149,6 +149,7 @@ function baseConvert(util, name, func) {
|
||||
};
|
||||
|
||||
var wrap = function(name, func) {
|
||||
name = mapping.aliasToReal[name] || name;
|
||||
var wrapper = wrappers[name];
|
||||
if (wrapper) {
|
||||
return wrapper(func);
|
||||
|
||||
@@ -85,13 +85,13 @@ exports.aryMethod = {
|
||||
'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
|
||||
'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
|
||||
'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq', 'every',
|
||||
'extend', 'filter', 'find', 'find', 'findIndex', 'findKey', 'findLast',
|
||||
'findLastIndex', 'findLastKey', 'flatMap', 'forEach', 'forEachRight', 'forIn',
|
||||
'forInRight', 'forOwn', 'forOwnRight', 'get', 'groupBy', 'gt', 'gte', 'has',
|
||||
'hasIn', 'includes', 'indexOf', 'intersection', 'invertBy', 'invoke',
|
||||
'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte',
|
||||
'map', 'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy',
|
||||
'omit', 'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
|
||||
'filter', 'find', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
|
||||
'findLastKey', 'flatMap', 'forEach', 'forEachRight', 'forIn', 'forInRight',
|
||||
'forOwn', 'forOwnRight', 'get', 'groupBy', 'gt', 'gte', 'has', 'hasIn',
|
||||
'includes', 'indexOf', 'intersection', 'invertBy', 'invoke', 'invokeMap',
|
||||
'isEqual', 'isMatch', 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map',
|
||||
'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy', 'omit',
|
||||
'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
|
||||
'partition', 'pick', 'pickBy', 'pull', 'pullAll', 'pullAt', 'random', 'range',
|
||||
'rangeRight', 'rearg', 'reject', 'remove', 'repeat', 'result', 'sampleSize',
|
||||
'some', 'sortBy', 'sortedIndex', 'sortedIndexOf', 'sortedLastIndex',
|
||||
|
||||
@@ -649,6 +649,33 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.extend');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should convert by name', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
function Foo() {}
|
||||
Foo.prototype = { 'b': 2 };
|
||||
|
||||
var object = { 'a': 1 };
|
||||
|
||||
if (!document) {
|
||||
var extend = convert('extend', _.extend),
|
||||
value = _.clone(object),
|
||||
actual = extend(value, new Foo);
|
||||
|
||||
assert.deepEqual(value, object);
|
||||
assert.deepEqual(actual, { 'a': 1, 'b': 2 });
|
||||
}
|
||||
else {
|
||||
skipTest(assert, 2);
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.fill');
|
||||
|
||||
(function() {
|
||||
|
||||
Reference in New Issue
Block a user