{"ast":null,"code":"import arrayEach from './_arrayEach.js';\nimport arrayPush from './_arrayPush.js';\nimport baseFunctions from './_baseFunctions.js';\nimport copyArray from './_copyArray.js';\nimport isFunction from './isFunction.js';\nimport isObject from './isObject.js';\nimport keys from './keys.js';\n\n/**\n * Adds all own enumerable string keyed function properties of a source\n * object to the destination object. If `object` is a function, then methods\n * are added to its prototype as well.\n *\n * **Note:** Use `_.runInContext` to create a pristine `lodash` function to\n * avoid conflicts caused by modifying the original.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {Function|Object} [object=lodash] The destination object.\n * @param {Object} source The object of functions to add.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.chain=true] Specify whether mixins are chainable.\n * @returns {Function|Object} Returns `object`.\n * @example\n *\n * function vowels(string) {\n *   return _.filter(string, function(v) {\n *     return /[aeiou]/i.test(v);\n *   });\n * }\n *\n * _.mixin({ 'vowels': vowels });\n * _.vowels('fred');\n * // => ['e']\n *\n * _('fred').vowels().value();\n * // => ['e']\n *\n * _.mixin({ 'vowels': vowels }, { 'chain': false });\n * _('fred').vowels();\n * // => ['e']\n */\nfunction mixin(object, source, options) {\n  var props = keys(source),\n    methodNames = baseFunctions(source, props);\n  var chain = !(isObject(options) && 'chain' in options) || !!options.chain,\n    isFunc = isFunction(object);\n  arrayEach(methodNames, function (methodName) {\n    var func = source[methodName];\n    object[methodName] = func;\n    if (isFunc) {\n      object.prototype[methodName] = function () {\n        var chainAll = this.__chain__;\n        if (chain || chainAll) {\n          var result = object(this.__wrapped__),\n            actions = result.__actions__ = copyArray(this.__actions__);\n          actions.push({\n            'func': func,\n            'args': arguments,\n            'thisArg': object\n          });\n          result.__chain__ = chainAll;\n          return result;\n        }\n        return func.apply(object, arrayPush([this.value()], arguments));\n      };\n    }\n  });\n  return object;\n}\nexport default mixin;","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}