index.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. /**
  2. * lodash (Custom Build) <https://lodash.com/>
  3. * Build: `lodash modularize exports="npm" -o ./`
  4. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  5. * Released under MIT license <https://lodash.com/license>
  6. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  7. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  8. */
  9. /** Used as references for various `Number` constants. */
  10. var INFINITY = 1 / 0,
  11. MAX_SAFE_INTEGER = 9007199254740991,
  12. MAX_INTEGER = 1.7976931348623157e+308,
  13. NAN = 0 / 0;
  14. /** `Object#toString` result references. */
  15. var argsTag = '[object Arguments]',
  16. funcTag = '[object Function]',
  17. genTag = '[object GeneratorFunction]',
  18. stringTag = '[object String]',
  19. symbolTag = '[object Symbol]';
  20. /** Used to match leading and trailing whitespace. */
  21. var reTrim = /^\s+|\s+$/g;
  22. /** Used to detect bad signed hexadecimal string values. */
  23. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  24. /** Used to detect binary string values. */
  25. var reIsBinary = /^0b[01]+$/i;
  26. /** Used to detect octal string values. */
  27. var reIsOctal = /^0o[0-7]+$/i;
  28. /** Used to detect unsigned integer values. */
  29. var reIsUint = /^(?:0|[1-9]\d*)$/;
  30. /** Built-in method references without a dependency on `root`. */
  31. var freeParseInt = parseInt;
  32. /**
  33. * A specialized version of `_.map` for arrays without support for iteratee
  34. * shorthands.
  35. *
  36. * @private
  37. * @param {Array} [array] The array to iterate over.
  38. * @param {Function} iteratee The function invoked per iteration.
  39. * @returns {Array} Returns the new mapped array.
  40. */
  41. function arrayMap(array, iteratee) {
  42. var index = -1,
  43. length = array ? array.length : 0,
  44. result = Array(length);
  45. while (++index < length) {
  46. result[index] = iteratee(array[index], index, array);
  47. }
  48. return result;
  49. }
  50. /**
  51. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  52. * support for iteratee shorthands.
  53. *
  54. * @private
  55. * @param {Array} array The array to inspect.
  56. * @param {Function} predicate The function invoked per iteration.
  57. * @param {number} fromIndex The index to search from.
  58. * @param {boolean} [fromRight] Specify iterating from right to left.
  59. * @returns {number} Returns the index of the matched value, else `-1`.
  60. */
  61. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  62. var length = array.length,
  63. index = fromIndex + (fromRight ? 1 : -1);
  64. while ((fromRight ? index-- : ++index < length)) {
  65. if (predicate(array[index], index, array)) {
  66. return index;
  67. }
  68. }
  69. return -1;
  70. }
  71. /**
  72. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  73. *
  74. * @private
  75. * @param {Array} array The array to inspect.
  76. * @param {*} value The value to search for.
  77. * @param {number} fromIndex The index to search from.
  78. * @returns {number} Returns the index of the matched value, else `-1`.
  79. */
  80. function baseIndexOf(array, value, fromIndex) {
  81. if (value !== value) {
  82. return baseFindIndex(array, baseIsNaN, fromIndex);
  83. }
  84. var index = fromIndex - 1,
  85. length = array.length;
  86. while (++index < length) {
  87. if (array[index] === value) {
  88. return index;
  89. }
  90. }
  91. return -1;
  92. }
  93. /**
  94. * The base implementation of `_.isNaN` without support for number objects.
  95. *
  96. * @private
  97. * @param {*} value The value to check.
  98. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  99. */
  100. function baseIsNaN(value) {
  101. return value !== value;
  102. }
  103. /**
  104. * The base implementation of `_.times` without support for iteratee shorthands
  105. * or max array length checks.
  106. *
  107. * @private
  108. * @param {number} n The number of times to invoke `iteratee`.
  109. * @param {Function} iteratee The function invoked per iteration.
  110. * @returns {Array} Returns the array of results.
  111. */
  112. function baseTimes(n, iteratee) {
  113. var index = -1,
  114. result = Array(n);
  115. while (++index < n) {
  116. result[index] = iteratee(index);
  117. }
  118. return result;
  119. }
  120. /**
  121. * The base implementation of `_.values` and `_.valuesIn` which creates an
  122. * array of `object` property values corresponding to the property names
  123. * of `props`.
  124. *
  125. * @private
  126. * @param {Object} object The object to query.
  127. * @param {Array} props The property names to get values for.
  128. * @returns {Object} Returns the array of property values.
  129. */
  130. function baseValues(object, props) {
  131. return arrayMap(props, function(key) {
  132. return object[key];
  133. });
  134. }
  135. /**
  136. * Creates a unary function that invokes `func` with its argument transformed.
  137. *
  138. * @private
  139. * @param {Function} func The function to wrap.
  140. * @param {Function} transform The argument transform.
  141. * @returns {Function} Returns the new function.
  142. */
  143. function overArg(func, transform) {
  144. return function(arg) {
  145. return func(transform(arg));
  146. };
  147. }
  148. /** Used for built-in method references. */
  149. var objectProto = Object.prototype;
  150. /** Used to check objects for own properties. */
  151. var hasOwnProperty = objectProto.hasOwnProperty;
  152. /**
  153. * Used to resolve the
  154. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  155. * of values.
  156. */
  157. var objectToString = objectProto.toString;
  158. /** Built-in value references. */
  159. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  160. /* Built-in method references for those with the same name as other `lodash` methods. */
  161. var nativeKeys = overArg(Object.keys, Object),
  162. nativeMax = Math.max;
  163. /**
  164. * Creates an array of the enumerable property names of the array-like `value`.
  165. *
  166. * @private
  167. * @param {*} value The value to query.
  168. * @param {boolean} inherited Specify returning inherited property names.
  169. * @returns {Array} Returns the array of property names.
  170. */
  171. function arrayLikeKeys(value, inherited) {
  172. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  173. // Safari 9 makes `arguments.length` enumerable in strict mode.
  174. var result = (isArray(value) || isArguments(value))
  175. ? baseTimes(value.length, String)
  176. : [];
  177. var length = result.length,
  178. skipIndexes = !!length;
  179. for (var key in value) {
  180. if ((inherited || hasOwnProperty.call(value, key)) &&
  181. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  182. result.push(key);
  183. }
  184. }
  185. return result;
  186. }
  187. /**
  188. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  189. *
  190. * @private
  191. * @param {Object} object The object to query.
  192. * @returns {Array} Returns the array of property names.
  193. */
  194. function baseKeys(object) {
  195. if (!isPrototype(object)) {
  196. return nativeKeys(object);
  197. }
  198. var result = [];
  199. for (var key in Object(object)) {
  200. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  201. result.push(key);
  202. }
  203. }
  204. return result;
  205. }
  206. /**
  207. * Checks if `value` is a valid array-like index.
  208. *
  209. * @private
  210. * @param {*} value The value to check.
  211. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  212. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  213. */
  214. function isIndex(value, length) {
  215. length = length == null ? MAX_SAFE_INTEGER : length;
  216. return !!length &&
  217. (typeof value == 'number' || reIsUint.test(value)) &&
  218. (value > -1 && value % 1 == 0 && value < length);
  219. }
  220. /**
  221. * Checks if `value` is likely a prototype object.
  222. *
  223. * @private
  224. * @param {*} value The value to check.
  225. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  226. */
  227. function isPrototype(value) {
  228. var Ctor = value && value.constructor,
  229. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  230. return value === proto;
  231. }
  232. /**
  233. * Checks if `value` is in `collection`. If `collection` is a string, it's
  234. * checked for a substring of `value`, otherwise
  235. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  236. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  237. * the offset from the end of `collection`.
  238. *
  239. * @static
  240. * @memberOf _
  241. * @since 0.1.0
  242. * @category Collection
  243. * @param {Array|Object|string} collection The collection to inspect.
  244. * @param {*} value The value to search for.
  245. * @param {number} [fromIndex=0] The index to search from.
  246. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  247. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  248. * @example
  249. *
  250. * _.includes([1, 2, 3], 1);
  251. * // => true
  252. *
  253. * _.includes([1, 2, 3], 1, 2);
  254. * // => false
  255. *
  256. * _.includes({ 'a': 1, 'b': 2 }, 1);
  257. * // => true
  258. *
  259. * _.includes('abcd', 'bc');
  260. * // => true
  261. */
  262. function includes(collection, value, fromIndex, guard) {
  263. collection = isArrayLike(collection) ? collection : values(collection);
  264. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  265. var length = collection.length;
  266. if (fromIndex < 0) {
  267. fromIndex = nativeMax(length + fromIndex, 0);
  268. }
  269. return isString(collection)
  270. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  271. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  272. }
  273. /**
  274. * Checks if `value` is likely an `arguments` object.
  275. *
  276. * @static
  277. * @memberOf _
  278. * @since 0.1.0
  279. * @category Lang
  280. * @param {*} value The value to check.
  281. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  282. * else `false`.
  283. * @example
  284. *
  285. * _.isArguments(function() { return arguments; }());
  286. * // => true
  287. *
  288. * _.isArguments([1, 2, 3]);
  289. * // => false
  290. */
  291. function isArguments(value) {
  292. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  293. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  294. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  295. }
  296. /**
  297. * Checks if `value` is classified as an `Array` object.
  298. *
  299. * @static
  300. * @memberOf _
  301. * @since 0.1.0
  302. * @category Lang
  303. * @param {*} value The value to check.
  304. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  305. * @example
  306. *
  307. * _.isArray([1, 2, 3]);
  308. * // => true
  309. *
  310. * _.isArray(document.body.children);
  311. * // => false
  312. *
  313. * _.isArray('abc');
  314. * // => false
  315. *
  316. * _.isArray(_.noop);
  317. * // => false
  318. */
  319. var isArray = Array.isArray;
  320. /**
  321. * Checks if `value` is array-like. A value is considered array-like if it's
  322. * not a function and has a `value.length` that's an integer greater than or
  323. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  324. *
  325. * @static
  326. * @memberOf _
  327. * @since 4.0.0
  328. * @category Lang
  329. * @param {*} value The value to check.
  330. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  331. * @example
  332. *
  333. * _.isArrayLike([1, 2, 3]);
  334. * // => true
  335. *
  336. * _.isArrayLike(document.body.children);
  337. * // => true
  338. *
  339. * _.isArrayLike('abc');
  340. * // => true
  341. *
  342. * _.isArrayLike(_.noop);
  343. * // => false
  344. */
  345. function isArrayLike(value) {
  346. return value != null && isLength(value.length) && !isFunction(value);
  347. }
  348. /**
  349. * This method is like `_.isArrayLike` except that it also checks if `value`
  350. * is an object.
  351. *
  352. * @static
  353. * @memberOf _
  354. * @since 4.0.0
  355. * @category Lang
  356. * @param {*} value The value to check.
  357. * @returns {boolean} Returns `true` if `value` is an array-like object,
  358. * else `false`.
  359. * @example
  360. *
  361. * _.isArrayLikeObject([1, 2, 3]);
  362. * // => true
  363. *
  364. * _.isArrayLikeObject(document.body.children);
  365. * // => true
  366. *
  367. * _.isArrayLikeObject('abc');
  368. * // => false
  369. *
  370. * _.isArrayLikeObject(_.noop);
  371. * // => false
  372. */
  373. function isArrayLikeObject(value) {
  374. return isObjectLike(value) && isArrayLike(value);
  375. }
  376. /**
  377. * Checks if `value` is classified as a `Function` object.
  378. *
  379. * @static
  380. * @memberOf _
  381. * @since 0.1.0
  382. * @category Lang
  383. * @param {*} value The value to check.
  384. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  385. * @example
  386. *
  387. * _.isFunction(_);
  388. * // => true
  389. *
  390. * _.isFunction(/abc/);
  391. * // => false
  392. */
  393. function isFunction(value) {
  394. // The use of `Object#toString` avoids issues with the `typeof` operator
  395. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  396. var tag = isObject(value) ? objectToString.call(value) : '';
  397. return tag == funcTag || tag == genTag;
  398. }
  399. /**
  400. * Checks if `value` is a valid array-like length.
  401. *
  402. * **Note:** This method is loosely based on
  403. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  404. *
  405. * @static
  406. * @memberOf _
  407. * @since 4.0.0
  408. * @category Lang
  409. * @param {*} value The value to check.
  410. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  411. * @example
  412. *
  413. * _.isLength(3);
  414. * // => true
  415. *
  416. * _.isLength(Number.MIN_VALUE);
  417. * // => false
  418. *
  419. * _.isLength(Infinity);
  420. * // => false
  421. *
  422. * _.isLength('3');
  423. * // => false
  424. */
  425. function isLength(value) {
  426. return typeof value == 'number' &&
  427. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  428. }
  429. /**
  430. * Checks if `value` is the
  431. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  432. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  433. *
  434. * @static
  435. * @memberOf _
  436. * @since 0.1.0
  437. * @category Lang
  438. * @param {*} value The value to check.
  439. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  440. * @example
  441. *
  442. * _.isObject({});
  443. * // => true
  444. *
  445. * _.isObject([1, 2, 3]);
  446. * // => true
  447. *
  448. * _.isObject(_.noop);
  449. * // => true
  450. *
  451. * _.isObject(null);
  452. * // => false
  453. */
  454. function isObject(value) {
  455. var type = typeof value;
  456. return !!value && (type == 'object' || type == 'function');
  457. }
  458. /**
  459. * Checks if `value` is object-like. A value is object-like if it's not `null`
  460. * and has a `typeof` result of "object".
  461. *
  462. * @static
  463. * @memberOf _
  464. * @since 4.0.0
  465. * @category Lang
  466. * @param {*} value The value to check.
  467. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  468. * @example
  469. *
  470. * _.isObjectLike({});
  471. * // => true
  472. *
  473. * _.isObjectLike([1, 2, 3]);
  474. * // => true
  475. *
  476. * _.isObjectLike(_.noop);
  477. * // => false
  478. *
  479. * _.isObjectLike(null);
  480. * // => false
  481. */
  482. function isObjectLike(value) {
  483. return !!value && typeof value == 'object';
  484. }
  485. /**
  486. * Checks if `value` is classified as a `String` primitive or object.
  487. *
  488. * @static
  489. * @since 0.1.0
  490. * @memberOf _
  491. * @category Lang
  492. * @param {*} value The value to check.
  493. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  494. * @example
  495. *
  496. * _.isString('abc');
  497. * // => true
  498. *
  499. * _.isString(1);
  500. * // => false
  501. */
  502. function isString(value) {
  503. return typeof value == 'string' ||
  504. (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);
  505. }
  506. /**
  507. * Checks if `value` is classified as a `Symbol` primitive or object.
  508. *
  509. * @static
  510. * @memberOf _
  511. * @since 4.0.0
  512. * @category Lang
  513. * @param {*} value The value to check.
  514. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  515. * @example
  516. *
  517. * _.isSymbol(Symbol.iterator);
  518. * // => true
  519. *
  520. * _.isSymbol('abc');
  521. * // => false
  522. */
  523. function isSymbol(value) {
  524. return typeof value == 'symbol' ||
  525. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  526. }
  527. /**
  528. * Converts `value` to a finite number.
  529. *
  530. * @static
  531. * @memberOf _
  532. * @since 4.12.0
  533. * @category Lang
  534. * @param {*} value The value to convert.
  535. * @returns {number} Returns the converted number.
  536. * @example
  537. *
  538. * _.toFinite(3.2);
  539. * // => 3.2
  540. *
  541. * _.toFinite(Number.MIN_VALUE);
  542. * // => 5e-324
  543. *
  544. * _.toFinite(Infinity);
  545. * // => 1.7976931348623157e+308
  546. *
  547. * _.toFinite('3.2');
  548. * // => 3.2
  549. */
  550. function toFinite(value) {
  551. if (!value) {
  552. return value === 0 ? value : 0;
  553. }
  554. value = toNumber(value);
  555. if (value === INFINITY || value === -INFINITY) {
  556. var sign = (value < 0 ? -1 : 1);
  557. return sign * MAX_INTEGER;
  558. }
  559. return value === value ? value : 0;
  560. }
  561. /**
  562. * Converts `value` to an integer.
  563. *
  564. * **Note:** This method is loosely based on
  565. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  566. *
  567. * @static
  568. * @memberOf _
  569. * @since 4.0.0
  570. * @category Lang
  571. * @param {*} value The value to convert.
  572. * @returns {number} Returns the converted integer.
  573. * @example
  574. *
  575. * _.toInteger(3.2);
  576. * // => 3
  577. *
  578. * _.toInteger(Number.MIN_VALUE);
  579. * // => 0
  580. *
  581. * _.toInteger(Infinity);
  582. * // => 1.7976931348623157e+308
  583. *
  584. * _.toInteger('3.2');
  585. * // => 3
  586. */
  587. function toInteger(value) {
  588. var result = toFinite(value),
  589. remainder = result % 1;
  590. return result === result ? (remainder ? result - remainder : result) : 0;
  591. }
  592. /**
  593. * Converts `value` to a number.
  594. *
  595. * @static
  596. * @memberOf _
  597. * @since 4.0.0
  598. * @category Lang
  599. * @param {*} value The value to process.
  600. * @returns {number} Returns the number.
  601. * @example
  602. *
  603. * _.toNumber(3.2);
  604. * // => 3.2
  605. *
  606. * _.toNumber(Number.MIN_VALUE);
  607. * // => 5e-324
  608. *
  609. * _.toNumber(Infinity);
  610. * // => Infinity
  611. *
  612. * _.toNumber('3.2');
  613. * // => 3.2
  614. */
  615. function toNumber(value) {
  616. if (typeof value == 'number') {
  617. return value;
  618. }
  619. if (isSymbol(value)) {
  620. return NAN;
  621. }
  622. if (isObject(value)) {
  623. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  624. value = isObject(other) ? (other + '') : other;
  625. }
  626. if (typeof value != 'string') {
  627. return value === 0 ? value : +value;
  628. }
  629. value = value.replace(reTrim, '');
  630. var isBinary = reIsBinary.test(value);
  631. return (isBinary || reIsOctal.test(value))
  632. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  633. : (reIsBadHex.test(value) ? NAN : +value);
  634. }
  635. /**
  636. * Creates an array of the own enumerable property names of `object`.
  637. *
  638. * **Note:** Non-object values are coerced to objects. See the
  639. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  640. * for more details.
  641. *
  642. * @static
  643. * @since 0.1.0
  644. * @memberOf _
  645. * @category Object
  646. * @param {Object} object The object to query.
  647. * @returns {Array} Returns the array of property names.
  648. * @example
  649. *
  650. * function Foo() {
  651. * this.a = 1;
  652. * this.b = 2;
  653. * }
  654. *
  655. * Foo.prototype.c = 3;
  656. *
  657. * _.keys(new Foo);
  658. * // => ['a', 'b'] (iteration order is not guaranteed)
  659. *
  660. * _.keys('hi');
  661. * // => ['0', '1']
  662. */
  663. function keys(object) {
  664. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  665. }
  666. /**
  667. * Creates an array of the own enumerable string keyed property values of `object`.
  668. *
  669. * **Note:** Non-object values are coerced to objects.
  670. *
  671. * @static
  672. * @since 0.1.0
  673. * @memberOf _
  674. * @category Object
  675. * @param {Object} object The object to query.
  676. * @returns {Array} Returns the array of property values.
  677. * @example
  678. *
  679. * function Foo() {
  680. * this.a = 1;
  681. * this.b = 2;
  682. * }
  683. *
  684. * Foo.prototype.c = 3;
  685. *
  686. * _.values(new Foo);
  687. * // => [1, 2] (iteration order is not guaranteed)
  688. *
  689. * _.values('hi');
  690. * // => ['h', 'i']
  691. */
  692. function values(object) {
  693. return object ? baseValues(object, keys(object)) : [];
  694. }
  695. module.exports = includes;