mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Clarify doc example for _.compose.
Former-commit-id: bcd9337d0cc2f7b6a1ca77723f8d20d768cb0b91
This commit is contained in:
21
lodash.js
21
lodash.js
@@ -5001,11 +5001,22 @@
|
|||||||
* @returns {Function} Returns the new composed function.
|
* @returns {Function} Returns the new composed function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var greet = function(name) { return 'hi ' + name; };
|
* var realNameMap = {
|
||||||
* var exclaim = function(statement) { return statement + '!'; };
|
* 'curly': 'jerome'
|
||||||
* var welcome = _.compose(exclaim, greet);
|
* };
|
||||||
* welcome('moe');
|
*
|
||||||
* // => 'hi moe!'
|
* var format = function(name) {
|
||||||
|
* name = realNameMap[name.toLowerCase()] || name;
|
||||||
|
* return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* var greet = function(formatted) {
|
||||||
|
* return 'Hiya ' + formatted + '!';
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* var welcome = _.compose(greet, format);
|
||||||
|
* welcome('curly');
|
||||||
|
* // => 'Hiya Jerome!'
|
||||||
*/
|
*/
|
||||||
function compose() {
|
function compose() {
|
||||||
var funcs = arguments;
|
var funcs = arguments;
|
||||||
|
|||||||
Reference in New Issue
Block a user