* Adds all own enumerable string keyed function properties of a source * object to the destination object. If `object` is a function, then methods * are added to its prototype as well. * * **Note:** Use `_.runInContext` to create a pristine `lodash` function to * avoid confl
(object, source, options)
| 15826 | * // => ['e'] |
| 15827 | */ |
| 15828 | function mixin(object, source, options) { |
| 15829 | var props = keys(source), |
| 15830 | methodNames = baseFunctions(source, props); |
| 15831 | |
| 15832 | if (options == null && |
| 15833 | !(isObject(source) && (methodNames.length || !props.length))) { |
| 15834 | options = source; |
| 15835 | source = object; |
| 15836 | object = this; |
| 15837 | methodNames = baseFunctions(source, keys(source)); |
| 15838 | } |
| 15839 | var chain = !(isObject(options) && 'chain' in options) || !!options.chain, |
| 15840 | isFunc = isFunction(object); |
| 15841 | |
| 15842 | arrayEach(methodNames, function(methodName) { |
| 15843 | var func = source[methodName]; |
| 15844 | object[methodName] = func; |
| 15845 | if (isFunc) { |
| 15846 | object.prototype[methodName] = function() { |
| 15847 | var chainAll = this.__chain__; |
| 15848 | if (chain || chainAll) { |
| 15849 | var result = object(this.__wrapped__), |
| 15850 | actions = result.__actions__ = copyArray(this.__actions__); |
| 15851 | |
| 15852 | actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); |
| 15853 | result.__chain__ = chainAll; |
| 15854 | return result; |
| 15855 | } |
| 15856 | return func.apply(object, arrayPush([this.value()], arguments)); |
| 15857 | }; |
| 15858 | } |
| 15859 | }); |
| 15860 | |
| 15861 | return object; |
| 15862 | } |
| 15863 | |
| 15864 | /** |
| 15865 | * Reverts the `_` variable to its previous value and returns a reference to |
no test coverage detected