mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Add options object to _.mixin. [closes #404]
This commit is contained in:
23
dist/lodash.underscore.js
vendored
23
dist/lodash.underscore.js
vendored
@@ -4235,27 +4235,32 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds function properties of a source object to the `lodash` function and
|
||||
* chainable wrapper.
|
||||
* Adds function properties of a source object to the destination object.
|
||||
* If `object` is a function methods will be added to its prototype as well.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Utilities
|
||||
* @param {Object} object The object of function properties to add to `lodash`.
|
||||
* @param {Object} object The object of function properties to add to `lodash`.
|
||||
* @param {Function|Object} [object=lodash] object The destination object.
|
||||
* @param {Object} source The object of functions to add.
|
||||
* @param {Object} [options] The options object.
|
||||
* @param {boolean} [options.chain=true] Specify whether the functions added are chainable.
|
||||
* @example
|
||||
*
|
||||
* _.mixin({
|
||||
* 'capitalize': function(string) {
|
||||
* return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
|
||||
* }
|
||||
* });
|
||||
* function capitalize(string) {
|
||||
* return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
|
||||
* }
|
||||
*
|
||||
* _.mixin({ 'capitalize': capitalize });
|
||||
* _.capitalize('fred');
|
||||
* // => 'Fred'
|
||||
*
|
||||
* _('fred').capitalize().value();
|
||||
* // => 'Fred'
|
||||
*
|
||||
* _.mixin({ 'capitalize': capitalize }, { 'chain': false });
|
||||
* _('fred').capitalize();
|
||||
* // => 'Fred'
|
||||
*/
|
||||
function mixin(object) {
|
||||
forEach(functions(object), function(methodName) {
|
||||
|
||||
Reference in New Issue
Block a user