lodash.fp.js 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["fp"] = factory();
  8. else
  9. root["fp"] = factory();
  10. })(this, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/ // The require function
  15. /******/ function __webpack_require__(moduleId) {
  16. /******/ // Check if module is in cache
  17. /******/ if(installedModules[moduleId])
  18. /******/ return installedModules[moduleId].exports;
  19. /******/ // Create a new module (and put it into the cache)
  20. /******/ var module = installedModules[moduleId] = {
  21. /******/ exports: {},
  22. /******/ id: moduleId,
  23. /******/ loaded: false
  24. /******/ };
  25. /******/ // Execute the module function
  26. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  27. /******/ // Flag the module as loaded
  28. /******/ module.loaded = true;
  29. /******/ // Return the exports of the module
  30. /******/ return module.exports;
  31. /******/ }
  32. /******/ // expose the modules object (__webpack_modules__)
  33. /******/ __webpack_require__.m = modules;
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/ // __webpack_public_path__
  37. /******/ __webpack_require__.p = "";
  38. /******/ // Load entry module and return exports
  39. /******/ return __webpack_require__(0);
  40. /******/ })
  41. /************************************************************************/
  42. /******/ ([
  43. /* 0 */
  44. /***/ function(module, exports, __webpack_require__) {
  45. var baseConvert = __webpack_require__(1);
  46. /**
  47. * Converts `lodash` to an immutable auto-curried iteratee-first data-last
  48. * version with conversion `options` applied.
  49. *
  50. * @param {Function} lodash The lodash function to convert.
  51. * @param {Object} [options] The options object. See `baseConvert` for more details.
  52. * @returns {Function} Returns the converted `lodash`.
  53. */
  54. function browserConvert(lodash, options) {
  55. return baseConvert(lodash, lodash, options);
  56. }
  57. if (typeof _ == 'function' && typeof _.runInContext == 'function') {
  58. // XXX: Customization in order to be able to run both _ and fp in the
  59. // non-AMD usecase.
  60. fp = browserConvert(_.runInContext());
  61. }
  62. module.exports = browserConvert;
  63. /***/ },
  64. /* 1 */
  65. /***/ function(module, exports, __webpack_require__) {
  66. var mapping = __webpack_require__(2),
  67. fallbackHolder = __webpack_require__(3);
  68. /** Built-in value reference. */
  69. var push = Array.prototype.push;
  70. /**
  71. * Creates a function, with an arity of `n`, that invokes `func` with the
  72. * arguments it receives.
  73. *
  74. * @private
  75. * @param {Function} func The function to wrap.
  76. * @param {number} n The arity of the new function.
  77. * @returns {Function} Returns the new function.
  78. */
  79. function baseArity(func, n) {
  80. return n == 2
  81. ? function(a, b) { return func.apply(undefined, arguments); }
  82. : function(a) { return func.apply(undefined, arguments); };
  83. }
  84. /**
  85. * Creates a function that invokes `func`, with up to `n` arguments, ignoring
  86. * any additional arguments.
  87. *
  88. * @private
  89. * @param {Function} func The function to cap arguments for.
  90. * @param {number} n The arity cap.
  91. * @returns {Function} Returns the new function.
  92. */
  93. function baseAry(func, n) {
  94. return n == 2
  95. ? function(a, b) { return func(a, b); }
  96. : function(a) { return func(a); };
  97. }
  98. /**
  99. * Creates a clone of `array`.
  100. *
  101. * @private
  102. * @param {Array} array The array to clone.
  103. * @returns {Array} Returns the cloned array.
  104. */
  105. function cloneArray(array) {
  106. var length = array ? array.length : 0,
  107. result = Array(length);
  108. while (length--) {
  109. result[length] = array[length];
  110. }
  111. return result;
  112. }
  113. /**
  114. * Creates a function that clones a given object using the assignment `func`.
  115. *
  116. * @private
  117. * @param {Function} func The assignment function.
  118. * @returns {Function} Returns the new cloner function.
  119. */
  120. function createCloner(func) {
  121. return function(object) {
  122. return func({}, object);
  123. };
  124. }
  125. /**
  126. * A specialized version of `_.spread` which flattens the spread array into
  127. * the arguments of the invoked `func`.
  128. *
  129. * @private
  130. * @param {Function} func The function to spread arguments over.
  131. * @param {number} start The start position of the spread.
  132. * @returns {Function} Returns the new function.
  133. */
  134. function flatSpread(func, start) {
  135. return function() {
  136. var length = arguments.length,
  137. lastIndex = length - 1,
  138. args = Array(length);
  139. while (length--) {
  140. args[length] = arguments[length];
  141. }
  142. var array = args[start],
  143. otherArgs = args.slice(0, start);
  144. if (array) {
  145. push.apply(otherArgs, array);
  146. }
  147. if (start != lastIndex) {
  148. push.apply(otherArgs, args.slice(start + 1));
  149. }
  150. return func.apply(this, otherArgs);
  151. };
  152. }
  153. /**
  154. * Creates a function that wraps `func` and uses `cloner` to clone the first
  155. * argument it receives.
  156. *
  157. * @private
  158. * @param {Function} func The function to wrap.
  159. * @param {Function} cloner The function to clone arguments.
  160. * @returns {Function} Returns the new immutable function.
  161. */
  162. function wrapImmutable(func, cloner) {
  163. return function() {
  164. var length = arguments.length;
  165. if (!length) {
  166. return;
  167. }
  168. var args = Array(length);
  169. while (length--) {
  170. args[length] = arguments[length];
  171. }
  172. var result = args[0] = cloner.apply(undefined, args);
  173. func.apply(undefined, args);
  174. return result;
  175. };
  176. }
  177. /**
  178. * The base implementation of `convert` which accepts a `util` object of methods
  179. * required to perform conversions.
  180. *
  181. * @param {Object} util The util object.
  182. * @param {string} name The name of the function to convert.
  183. * @param {Function} func The function to convert.
  184. * @param {Object} [options] The options object.
  185. * @param {boolean} [options.cap=true] Specify capping iteratee arguments.
  186. * @param {boolean} [options.curry=true] Specify currying.
  187. * @param {boolean} [options.fixed=true] Specify fixed arity.
  188. * @param {boolean} [options.immutable=true] Specify immutable operations.
  189. * @param {boolean} [options.rearg=true] Specify rearranging arguments.
  190. * @returns {Function|Object} Returns the converted function or object.
  191. */
  192. function baseConvert(util, name, func, options) {
  193. var setPlaceholder,
  194. isLib = typeof name == 'function',
  195. isObj = name === Object(name);
  196. if (isObj) {
  197. options = func;
  198. func = name;
  199. name = undefined;
  200. }
  201. if (func == null) {
  202. throw new TypeError;
  203. }
  204. options || (options = {});
  205. var config = {
  206. 'cap': 'cap' in options ? options.cap : true,
  207. 'curry': 'curry' in options ? options.curry : true,
  208. 'fixed': 'fixed' in options ? options.fixed : true,
  209. 'immutable': 'immutable' in options ? options.immutable : true,
  210. 'rearg': 'rearg' in options ? options.rearg : true
  211. };
  212. var forceCurry = ('curry' in options) && options.curry,
  213. forceFixed = ('fixed' in options) && options.fixed,
  214. forceRearg = ('rearg' in options) && options.rearg,
  215. placeholder = isLib ? func : fallbackHolder,
  216. pristine = isLib ? func.runInContext() : undefined;
  217. var helpers = isLib ? func : {
  218. 'ary': util.ary,
  219. 'assign': util.assign,
  220. 'clone': util.clone,
  221. 'curry': util.curry,
  222. 'forEach': util.forEach,
  223. 'isArray': util.isArray,
  224. 'isFunction': util.isFunction,
  225. 'iteratee': util.iteratee,
  226. 'keys': util.keys,
  227. 'rearg': util.rearg,
  228. 'toInteger': util.toInteger,
  229. 'toPath': util.toPath
  230. };
  231. var ary = helpers.ary,
  232. assign = helpers.assign,
  233. clone = helpers.clone,
  234. curry = helpers.curry,
  235. each = helpers.forEach,
  236. isArray = helpers.isArray,
  237. isFunction = helpers.isFunction,
  238. keys = helpers.keys,
  239. rearg = helpers.rearg,
  240. toInteger = helpers.toInteger,
  241. toPath = helpers.toPath;
  242. var aryMethodKeys = keys(mapping.aryMethod);
  243. var wrappers = {
  244. 'castArray': function(castArray) {
  245. return function() {
  246. var value = arguments[0];
  247. return isArray(value)
  248. ? castArray(cloneArray(value))
  249. : castArray.apply(undefined, arguments);
  250. };
  251. },
  252. 'iteratee': function(iteratee) {
  253. return function() {
  254. var func = arguments[0],
  255. arity = arguments[1],
  256. result = iteratee(func, arity),
  257. length = result.length;
  258. if (config.cap && typeof arity == 'number') {
  259. arity = arity > 2 ? (arity - 2) : 1;
  260. return (length && length <= arity) ? result : baseAry(result, arity);
  261. }
  262. return result;
  263. };
  264. },
  265. 'mixin': function(mixin) {
  266. return function(source) {
  267. var func = this;
  268. if (!isFunction(func)) {
  269. return mixin(func, Object(source));
  270. }
  271. var pairs = [];
  272. each(keys(source), function(key) {
  273. if (isFunction(source[key])) {
  274. pairs.push([key, func.prototype[key]]);
  275. }
  276. });
  277. mixin(func, Object(source));
  278. each(pairs, function(pair) {
  279. var value = pair[1];
  280. if (isFunction(value)) {
  281. func.prototype[pair[0]] = value;
  282. } else {
  283. delete func.prototype[pair[0]];
  284. }
  285. });
  286. return func;
  287. };
  288. },
  289. 'nthArg': function(nthArg) {
  290. return function(n) {
  291. var arity = n < 0 ? 1 : (toInteger(n) + 1);
  292. return curry(nthArg(n), arity);
  293. };
  294. },
  295. 'rearg': function(rearg) {
  296. return function(func, indexes) {
  297. var arity = indexes ? indexes.length : 0;
  298. return curry(rearg(func, indexes), arity);
  299. };
  300. },
  301. 'runInContext': function(runInContext) {
  302. return function(context) {
  303. return baseConvert(util, runInContext(context), options);
  304. };
  305. }
  306. };
  307. /*--------------------------------------------------------------------------*/
  308. /**
  309. * Casts `func` to a function with an arity capped iteratee if needed.
  310. *
  311. * @private
  312. * @param {string} name The name of the function to inspect.
  313. * @param {Function} func The function to inspect.
  314. * @returns {Function} Returns the cast function.
  315. */
  316. function castCap(name, func) {
  317. if (config.cap) {
  318. var indexes = mapping.iterateeRearg[name];
  319. if (indexes) {
  320. return iterateeRearg(func, indexes);
  321. }
  322. var n = !isLib && mapping.iterateeAry[name];
  323. if (n) {
  324. return iterateeAry(func, n);
  325. }
  326. }
  327. return func;
  328. }
  329. /**
  330. * Casts `func` to a curried function if needed.
  331. *
  332. * @private
  333. * @param {string} name The name of the function to inspect.
  334. * @param {Function} func The function to inspect.
  335. * @param {number} n The arity of `func`.
  336. * @returns {Function} Returns the cast function.
  337. */
  338. function castCurry(name, func, n) {
  339. return (forceCurry || (config.curry && n > 1))
  340. ? curry(func, n)
  341. : func;
  342. }
  343. /**
  344. * Casts `func` to a fixed arity function if needed.
  345. *
  346. * @private
  347. * @param {string} name The name of the function to inspect.
  348. * @param {Function} func The function to inspect.
  349. * @param {number} n The arity cap.
  350. * @returns {Function} Returns the cast function.
  351. */
  352. function castFixed(name, func, n) {
  353. if (config.fixed && (forceFixed || !mapping.skipFixed[name])) {
  354. var data = mapping.methodSpread[name],
  355. start = data && data.start;
  356. return start === undefined ? ary(func, n) : flatSpread(func, start);
  357. }
  358. return func;
  359. }
  360. /**
  361. * Casts `func` to an rearged function if needed.
  362. *
  363. * @private
  364. * @param {string} name The name of the function to inspect.
  365. * @param {Function} func The function to inspect.
  366. * @param {number} n The arity of `func`.
  367. * @returns {Function} Returns the cast function.
  368. */
  369. function castRearg(name, func, n) {
  370. return (config.rearg && n > 1 && (forceRearg || !mapping.skipRearg[name]))
  371. ? rearg(func, mapping.methodRearg[name] || mapping.aryRearg[n])
  372. : func;
  373. }
  374. /**
  375. * Creates a clone of `object` by `path`.
  376. *
  377. * @private
  378. * @param {Object} object The object to clone.
  379. * @param {Array|string} path The path to clone by.
  380. * @returns {Object} Returns the cloned object.
  381. */
  382. function cloneByPath(object, path) {
  383. path = toPath(path);
  384. var index = -1,
  385. length = path.length,
  386. lastIndex = length - 1,
  387. result = clone(Object(object)),
  388. nested = result;
  389. while (nested != null && ++index < length) {
  390. var key = path[index],
  391. value = nested[key];
  392. if (value != null) {
  393. nested[path[index]] = clone(index == lastIndex ? value : Object(value));
  394. }
  395. nested = nested[key];
  396. }
  397. return result;
  398. }
  399. /**
  400. * Converts `lodash` to an immutable auto-curried iteratee-first data-last
  401. * version with conversion `options` applied.
  402. *
  403. * @param {Object} [options] The options object. See `baseConvert` for more details.
  404. * @returns {Function} Returns the converted `lodash`.
  405. */
  406. function convertLib(options) {
  407. return _.runInContext.convert(options)(undefined);
  408. }
  409. /**
  410. * Create a converter function for `func` of `name`.
  411. *
  412. * @param {string} name The name of the function to convert.
  413. * @param {Function} func The function to convert.
  414. * @returns {Function} Returns the new converter function.
  415. */
  416. function createConverter(name, func) {
  417. var realName = mapping.aliasToReal[name] || name,
  418. methodName = mapping.remap[realName] || realName,
  419. oldOptions = options;
  420. return function(options) {
  421. var newUtil = isLib ? pristine : helpers,
  422. newFunc = isLib ? pristine[methodName] : func,
  423. newOptions = assign(assign({}, oldOptions), options);
  424. return baseConvert(newUtil, realName, newFunc, newOptions);
  425. };
  426. }
  427. /**
  428. * Creates a function that wraps `func` to invoke its iteratee, with up to `n`
  429. * arguments, ignoring any additional arguments.
  430. *
  431. * @private
  432. * @param {Function} func The function to cap iteratee arguments for.
  433. * @param {number} n The arity cap.
  434. * @returns {Function} Returns the new function.
  435. */
  436. function iterateeAry(func, n) {
  437. return overArg(func, function(func) {
  438. return typeof func == 'function' ? baseAry(func, n) : func;
  439. });
  440. }
  441. /**
  442. * Creates a function that wraps `func` to invoke its iteratee with arguments
  443. * arranged according to the specified `indexes` where the argument value at
  444. * the first index is provided as the first argument, the argument value at
  445. * the second index is provided as the second argument, and so on.
  446. *
  447. * @private
  448. * @param {Function} func The function to rearrange iteratee arguments for.
  449. * @param {number[]} indexes The arranged argument indexes.
  450. * @returns {Function} Returns the new function.
  451. */
  452. function iterateeRearg(func, indexes) {
  453. return overArg(func, function(func) {
  454. var n = indexes.length;
  455. return baseArity(rearg(baseAry(func, n), indexes), n);
  456. });
  457. }
  458. /**
  459. * Creates a function that invokes `func` with its first argument transformed.
  460. *
  461. * @private
  462. * @param {Function} func The function to wrap.
  463. * @param {Function} transform The argument transform.
  464. * @returns {Function} Returns the new function.
  465. */
  466. function overArg(func, transform) {
  467. return function() {
  468. var length = arguments.length;
  469. if (!length) {
  470. return func();
  471. }
  472. var args = Array(length);
  473. while (length--) {
  474. args[length] = arguments[length];
  475. }
  476. var index = config.rearg ? 0 : (length - 1);
  477. args[index] = transform(args[index]);
  478. return func.apply(undefined, args);
  479. };
  480. }
  481. /**
  482. * Creates a function that wraps `func` and applys the conversions
  483. * rules by `name`.
  484. *
  485. * @private
  486. * @param {string} name The name of the function to wrap.
  487. * @param {Function} func The function to wrap.
  488. * @returns {Function} Returns the converted function.
  489. */
  490. function wrap(name, func) {
  491. var result,
  492. realName = mapping.aliasToReal[name] || name,
  493. wrapped = func,
  494. wrapper = wrappers[realName];
  495. if (wrapper) {
  496. wrapped = wrapper(func);
  497. }
  498. else if (config.immutable) {
  499. if (mapping.mutate.array[realName]) {
  500. wrapped = wrapImmutable(func, cloneArray);
  501. }
  502. else if (mapping.mutate.object[realName]) {
  503. wrapped = wrapImmutable(func, createCloner(func));
  504. }
  505. else if (mapping.mutate.set[realName]) {
  506. wrapped = wrapImmutable(func, cloneByPath);
  507. }
  508. }
  509. each(aryMethodKeys, function(aryKey) {
  510. each(mapping.aryMethod[aryKey], function(otherName) {
  511. if (realName == otherName) {
  512. var data = mapping.methodSpread[realName],
  513. afterRearg = data && data.afterRearg;
  514. result = afterRearg
  515. ? castFixed(realName, castRearg(realName, wrapped, aryKey), aryKey)
  516. : castRearg(realName, castFixed(realName, wrapped, aryKey), aryKey);
  517. result = castCap(realName, result);
  518. result = castCurry(realName, result, aryKey);
  519. return false;
  520. }
  521. });
  522. return !result;
  523. });
  524. result || (result = wrapped);
  525. if (result == func) {
  526. result = forceCurry ? curry(result, 1) : function() {
  527. return func.apply(this, arguments);
  528. };
  529. }
  530. result.convert = createConverter(realName, func);
  531. if (mapping.placeholder[realName]) {
  532. setPlaceholder = true;
  533. result.placeholder = func.placeholder = placeholder;
  534. }
  535. return result;
  536. }
  537. /*--------------------------------------------------------------------------*/
  538. if (!isObj) {
  539. return wrap(name, func);
  540. }
  541. var _ = func;
  542. // Convert methods by ary cap.
  543. var pairs = [];
  544. each(aryMethodKeys, function(aryKey) {
  545. each(mapping.aryMethod[aryKey], function(key) {
  546. var func = _[mapping.remap[key] || key];
  547. if (func) {
  548. pairs.push([key, wrap(key, func)]);
  549. }
  550. });
  551. });
  552. // Convert remaining methods.
  553. each(keys(_), function(key) {
  554. var func = _[key];
  555. if (typeof func == 'function') {
  556. var length = pairs.length;
  557. while (length--) {
  558. if (pairs[length][0] == key) {
  559. return;
  560. }
  561. }
  562. func.convert = createConverter(key, func);
  563. pairs.push([key, func]);
  564. }
  565. });
  566. // Assign to `_` leaving `_.prototype` unchanged to allow chaining.
  567. each(pairs, function(pair) {
  568. _[pair[0]] = pair[1];
  569. });
  570. _.convert = convertLib;
  571. if (setPlaceholder) {
  572. _.placeholder = placeholder;
  573. }
  574. // Assign aliases.
  575. each(keys(_), function(key) {
  576. each(mapping.realToAlias[key] || [], function(alias) {
  577. _[alias] = _[key];
  578. });
  579. });
  580. return _;
  581. }
  582. module.exports = baseConvert;
  583. /***/ },
  584. /* 2 */
  585. /***/ function(module, exports) {
  586. /** Used to map aliases to their real names. */
  587. exports.aliasToReal = {
  588. // Lodash aliases.
  589. 'each': 'forEach',
  590. 'eachRight': 'forEachRight',
  591. 'entries': 'toPairs',
  592. 'entriesIn': 'toPairsIn',
  593. 'extend': 'assignIn',
  594. 'extendAll': 'assignInAll',
  595. 'extendAllWith': 'assignInAllWith',
  596. 'extendWith': 'assignInWith',
  597. 'first': 'head',
  598. // Methods that are curried variants of others.
  599. 'conforms': 'conformsTo',
  600. 'matches': 'isMatch',
  601. 'property': 'get',
  602. // Ramda aliases.
  603. '__': 'placeholder',
  604. 'F': 'stubFalse',
  605. 'T': 'stubTrue',
  606. 'all': 'every',
  607. 'allPass': 'overEvery',
  608. 'always': 'constant',
  609. 'any': 'some',
  610. 'anyPass': 'overSome',
  611. 'apply': 'spread',
  612. 'assoc': 'set',
  613. 'assocPath': 'set',
  614. 'complement': 'negate',
  615. 'compose': 'flowRight',
  616. 'contains': 'includes',
  617. 'dissoc': 'unset',
  618. 'dissocPath': 'unset',
  619. 'dropLast': 'dropRight',
  620. 'dropLastWhile': 'dropRightWhile',
  621. 'equals': 'isEqual',
  622. 'identical': 'eq',
  623. 'indexBy': 'keyBy',
  624. 'init': 'initial',
  625. 'invertObj': 'invert',
  626. 'juxt': 'over',
  627. 'omitAll': 'omit',
  628. 'nAry': 'ary',
  629. 'path': 'get',
  630. 'pathEq': 'matchesProperty',
  631. 'pathOr': 'getOr',
  632. 'paths': 'at',
  633. 'pickAll': 'pick',
  634. 'pipe': 'flow',
  635. 'pluck': 'map',
  636. 'prop': 'get',
  637. 'propEq': 'matchesProperty',
  638. 'propOr': 'getOr',
  639. 'props': 'at',
  640. 'symmetricDifference': 'xor',
  641. 'symmetricDifferenceBy': 'xorBy',
  642. 'symmetricDifferenceWith': 'xorWith',
  643. 'takeLast': 'takeRight',
  644. 'takeLastWhile': 'takeRightWhile',
  645. 'unapply': 'rest',
  646. 'unnest': 'flatten',
  647. 'useWith': 'overArgs',
  648. 'where': 'conformsTo',
  649. 'whereEq': 'isMatch',
  650. 'zipObj': 'zipObject'
  651. };
  652. /** Used to map ary to method names. */
  653. exports.aryMethod = {
  654. '1': [
  655. 'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create',
  656. 'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow',
  657. 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'mergeAll',
  658. 'methodOf', 'mixin', 'nthArg', 'over', 'overEvery', 'overSome','rest', 'reverse',
  659. 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart',
  660. 'uniqueId', 'words', 'zipAll'
  661. ],
  662. '2': [
  663. 'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith',
  664. 'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith',
  665. 'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN',
  666. 'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference',
  667. 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq',
  668. 'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
  669. 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', 'forEach',
  670. 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', 'get',
  671. 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', 'intersection',
  672. 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy',
  673. 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues', 'matchesProperty',
  674. 'maxBy', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit',
  675. 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial',
  676. 'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll',
  677. 'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
  678. 'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
  679. 'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
  680. 'split', 'spreadFrom', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight',
  681. 'takeRightWhile', 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars',
  682. 'trimCharsEnd', 'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith',
  683. 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject',
  684. 'zipObjectDeep'
  685. ],
  686. '3': [
  687. 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
  688. 'findFrom', 'findIndexFrom', 'findLastFrom', 'findLastIndexFrom', 'getOr',
  689. 'includesFrom', 'indexOfFrom', 'inRange', 'intersectionBy', 'intersectionWith',
  690. 'invokeArgs', 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth',
  691. 'lastIndexOfFrom', 'mergeWith', 'orderBy', 'padChars', 'padCharsEnd',
  692. 'padCharsStart', 'pullAllBy', 'pullAllWith', 'rangeStep', 'rangeStepRight',
  693. 'reduce', 'reduceRight', 'replace', 'set', 'slice', 'sortedIndexBy',
  694. 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', 'update', 'xorBy',
  695. 'xorWith', 'zipWith'
  696. ],
  697. '4': [
  698. 'fill', 'setWith', 'updateWith'
  699. ]
  700. };
  701. /** Used to map ary to rearg configs. */
  702. exports.aryRearg = {
  703. '2': [1, 0],
  704. '3': [2, 0, 1],
  705. '4': [3, 2, 0, 1]
  706. };
  707. /** Used to map method names to their iteratee ary. */
  708. exports.iterateeAry = {
  709. 'dropRightWhile': 1,
  710. 'dropWhile': 1,
  711. 'every': 1,
  712. 'filter': 1,
  713. 'find': 1,
  714. 'findFrom': 1,
  715. 'findIndex': 1,
  716. 'findIndexFrom': 1,
  717. 'findKey': 1,
  718. 'findLast': 1,
  719. 'findLastFrom': 1,
  720. 'findLastIndex': 1,
  721. 'findLastIndexFrom': 1,
  722. 'findLastKey': 1,
  723. 'flatMap': 1,
  724. 'flatMapDeep': 1,
  725. 'flatMapDepth': 1,
  726. 'forEach': 1,
  727. 'forEachRight': 1,
  728. 'forIn': 1,
  729. 'forInRight': 1,
  730. 'forOwn': 1,
  731. 'forOwnRight': 1,
  732. 'map': 1,
  733. 'mapKeys': 1,
  734. 'mapValues': 1,
  735. 'partition': 1,
  736. 'reduce': 2,
  737. 'reduceRight': 2,
  738. 'reject': 1,
  739. 'remove': 1,
  740. 'some': 1,
  741. 'takeRightWhile': 1,
  742. 'takeWhile': 1,
  743. 'times': 1,
  744. 'transform': 2
  745. };
  746. /** Used to map method names to iteratee rearg configs. */
  747. exports.iterateeRearg = {
  748. 'mapKeys': [1],
  749. 'reduceRight': [1, 0]
  750. };
  751. /** Used to map method names to rearg configs. */
  752. exports.methodRearg = {
  753. 'assignInAllWith': [1, 0],
  754. 'assignInWith': [1, 2, 0],
  755. 'assignAllWith': [1, 0],
  756. 'assignWith': [1, 2, 0],
  757. 'differenceBy': [1, 2, 0],
  758. 'differenceWith': [1, 2, 0],
  759. 'getOr': [2, 1, 0],
  760. 'intersectionBy': [1, 2, 0],
  761. 'intersectionWith': [1, 2, 0],
  762. 'isEqualWith': [1, 2, 0],
  763. 'isMatchWith': [2, 1, 0],
  764. 'mergeAllWith': [1, 0],
  765. 'mergeWith': [1, 2, 0],
  766. 'padChars': [2, 1, 0],
  767. 'padCharsEnd': [2, 1, 0],
  768. 'padCharsStart': [2, 1, 0],
  769. 'pullAllBy': [2, 1, 0],
  770. 'pullAllWith': [2, 1, 0],
  771. 'rangeStep': [1, 2, 0],
  772. 'rangeStepRight': [1, 2, 0],
  773. 'setWith': [3, 1, 2, 0],
  774. 'sortedIndexBy': [2, 1, 0],
  775. 'sortedLastIndexBy': [2, 1, 0],
  776. 'unionBy': [1, 2, 0],
  777. 'unionWith': [1, 2, 0],
  778. 'updateWith': [3, 1, 2, 0],
  779. 'xorBy': [1, 2, 0],
  780. 'xorWith': [1, 2, 0],
  781. 'zipWith': [1, 2, 0]
  782. };
  783. /** Used to map method names to spread configs. */
  784. exports.methodSpread = {
  785. 'assignAll': { 'start': 0 },
  786. 'assignAllWith': { 'start': 0 },
  787. 'assignInAll': { 'start': 0 },
  788. 'assignInAllWith': { 'start': 0 },
  789. 'defaultsAll': { 'start': 0 },
  790. 'defaultsDeepAll': { 'start': 0 },
  791. 'invokeArgs': { 'start': 2 },
  792. 'invokeArgsMap': { 'start': 2 },
  793. 'mergeAll': { 'start': 0 },
  794. 'mergeAllWith': { 'start': 0 },
  795. 'partial': { 'start': 1 },
  796. 'partialRight': { 'start': 1 },
  797. 'without': { 'start': 1 },
  798. 'zipAll': { 'start': 0 }
  799. };
  800. /** Used to identify methods which mutate arrays or objects. */
  801. exports.mutate = {
  802. 'array': {
  803. 'fill': true,
  804. 'pull': true,
  805. 'pullAll': true,
  806. 'pullAllBy': true,
  807. 'pullAllWith': true,
  808. 'pullAt': true,
  809. 'remove': true,
  810. 'reverse': true
  811. },
  812. 'object': {
  813. 'assign': true,
  814. 'assignAll': true,
  815. 'assignAllWith': true,
  816. 'assignIn': true,
  817. 'assignInAll': true,
  818. 'assignInAllWith': true,
  819. 'assignInWith': true,
  820. 'assignWith': true,
  821. 'defaults': true,
  822. 'defaultsAll': true,
  823. 'defaultsDeep': true,
  824. 'defaultsDeepAll': true,
  825. 'merge': true,
  826. 'mergeAll': true,
  827. 'mergeAllWith': true,
  828. 'mergeWith': true,
  829. },
  830. 'set': {
  831. 'set': true,
  832. 'setWith': true,
  833. 'unset': true,
  834. 'update': true,
  835. 'updateWith': true
  836. }
  837. };
  838. /** Used to track methods with placeholder support */
  839. exports.placeholder = {
  840. 'bind': true,
  841. 'bindKey': true,
  842. 'curry': true,
  843. 'curryRight': true,
  844. 'partial': true,
  845. 'partialRight': true
  846. };
  847. /** Used to map real names to their aliases. */
  848. exports.realToAlias = (function() {
  849. var hasOwnProperty = Object.prototype.hasOwnProperty,
  850. object = exports.aliasToReal,
  851. result = {};
  852. for (var key in object) {
  853. var value = object[key];
  854. if (hasOwnProperty.call(result, value)) {
  855. result[value].push(key);
  856. } else {
  857. result[value] = [key];
  858. }
  859. }
  860. return result;
  861. }());
  862. /** Used to map method names to other names. */
  863. exports.remap = {
  864. 'assignAll': 'assign',
  865. 'assignAllWith': 'assignWith',
  866. 'assignInAll': 'assignIn',
  867. 'assignInAllWith': 'assignInWith',
  868. 'curryN': 'curry',
  869. 'curryRightN': 'curryRight',
  870. 'defaultsAll': 'defaults',
  871. 'defaultsDeepAll': 'defaultsDeep',
  872. 'findFrom': 'find',
  873. 'findIndexFrom': 'findIndex',
  874. 'findLastFrom': 'findLast',
  875. 'findLastIndexFrom': 'findLastIndex',
  876. 'getOr': 'get',
  877. 'includesFrom': 'includes',
  878. 'indexOfFrom': 'indexOf',
  879. 'invokeArgs': 'invoke',
  880. 'invokeArgsMap': 'invokeMap',
  881. 'lastIndexOfFrom': 'lastIndexOf',
  882. 'mergeAll': 'merge',
  883. 'mergeAllWith': 'mergeWith',
  884. 'padChars': 'pad',
  885. 'padCharsEnd': 'padEnd',
  886. 'padCharsStart': 'padStart',
  887. 'propertyOf': 'get',
  888. 'rangeStep': 'range',
  889. 'rangeStepRight': 'rangeRight',
  890. 'restFrom': 'rest',
  891. 'spreadFrom': 'spread',
  892. 'trimChars': 'trim',
  893. 'trimCharsEnd': 'trimEnd',
  894. 'trimCharsStart': 'trimStart',
  895. 'zipAll': 'zip'
  896. };
  897. /** Used to track methods that skip fixing their arity. */
  898. exports.skipFixed = {
  899. 'castArray': true,
  900. 'flow': true,
  901. 'flowRight': true,
  902. 'iteratee': true,
  903. 'mixin': true,
  904. 'rearg': true,
  905. 'runInContext': true
  906. };
  907. /** Used to track methods that skip rearranging arguments. */
  908. exports.skipRearg = {
  909. 'add': true,
  910. 'assign': true,
  911. 'assignIn': true,
  912. 'bind': true,
  913. 'bindKey': true,
  914. 'concat': true,
  915. 'difference': true,
  916. 'divide': true,
  917. 'eq': true,
  918. 'gt': true,
  919. 'gte': true,
  920. 'isEqual': true,
  921. 'lt': true,
  922. 'lte': true,
  923. 'matchesProperty': true,
  924. 'merge': true,
  925. 'multiply': true,
  926. 'overArgs': true,
  927. 'partial': true,
  928. 'partialRight': true,
  929. 'propertyOf': true,
  930. 'random': true,
  931. 'range': true,
  932. 'rangeRight': true,
  933. 'subtract': true,
  934. 'zip': true,
  935. 'zipObject': true,
  936. 'zipObjectDeep': true
  937. };
  938. /***/ },
  939. /* 3 */
  940. /***/ function(module, exports) {
  941. /**
  942. * The default argument placeholder value for methods.
  943. *
  944. * @type {Object}
  945. */
  946. module.exports = {};
  947. /***/ }
  948. /******/ ])
  949. });
  950. ;