mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
Add placeholders to fp wrapper. [closes #1780]
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
var mapping = require('./mapping.js'),
|
var mapping = require('./mapping.js'),
|
||||||
mutateMap = mapping.mutate;
|
mutateMap = mapping.mutate,
|
||||||
|
placeholder = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `convert` which accepts a `util` object of methods
|
* The base implementation of `convert` which accepts a `util` object of methods
|
||||||
@@ -176,7 +177,12 @@ function baseConvert(util, name, func) {
|
|||||||
});
|
});
|
||||||
return !result;
|
return !result;
|
||||||
});
|
});
|
||||||
return result || func;
|
|
||||||
|
result || (result = func);
|
||||||
|
if (mapping.placeholder[name]) {
|
||||||
|
result.placeholder = placeholder;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!isLib) {
|
if (!isLib) {
|
||||||
|
|||||||
@@ -152,6 +152,16 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Used to track methods with placeholder support */
|
||||||
|
'placeholder': {
|
||||||
|
'bind': true,
|
||||||
|
'bindKey': true,
|
||||||
|
'curry': true,
|
||||||
|
'curryRight': true,
|
||||||
|
'partial': true,
|
||||||
|
'partialRight': true
|
||||||
|
},
|
||||||
|
|
||||||
/** Used to track methods that skip `_.rearg`. */
|
/** Used to track methods that skip `_.rearg`. */
|
||||||
'skipRearg': {
|
'skipRearg': {
|
||||||
'assign': true,
|
'assign': true,
|
||||||
|
|||||||
@@ -563,6 +563,20 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('placeholder methods');
|
||||||
|
|
||||||
|
_.forOwn(mapping.placeholder, function(truthy, methodName) {
|
||||||
|
var func = fp[methodName];
|
||||||
|
|
||||||
|
QUnit.test('`_.' + methodName + '` should have a `placeholder` property', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
assert.ok(_.isObject(func.placeholder));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('fp.random');
|
QUnit.module('fp.random');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user