From c5dac98e1d8cfd1a0439176907718fa4dd26f175 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 19 Jan 2017 15:24:04 -0800 Subject: [PATCH] Remove more modules that have ES equivs. --- entries.js | 1 - fill.js | 43 ------------------------------------------- findIndex.js | 41 ----------------------------------------- isInteger.js | 32 -------------------------------- isSafeInteger.js | 35 ----------------------------------- toPairs.js | 40 ---------------------------------------- 6 files changed, 192 deletions(-) delete mode 100644 entries.js delete mode 100644 fill.js delete mode 100644 findIndex.js delete mode 100644 isInteger.js delete mode 100644 isSafeInteger.js delete mode 100644 toPairs.js diff --git a/entries.js b/entries.js deleted file mode 100644 index 6f408ebd7..000000000 --- a/entries.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './toPairs.js'; diff --git a/fill.js b/fill.js deleted file mode 100644 index 014571ba0..000000000 --- a/fill.js +++ /dev/null @@ -1,43 +0,0 @@ -import baseFill from './.internal/baseFill.js'; -import isIterateeCall from './.internal/isIterateeCall.js'; - -/** - * Fills elements of `array` with `value` from `start` up to, but not - * including, `end`. - * - * **Note:** This method mutates `array`. - * - * @since 3.2.0 - * @category Array - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - * @example - * - * const array = [1, 2, 3]; - * - * fill(array, 'a'); - * console.log(array); - * // => ['a', 'a', 'a'] - * - * fill(Array(3), 2); - * // => [2, 2, 2] - * - * fill([4, 6, 8, 10], '*', 1, 3); - * // => [4, '*', '*', 10] - */ -function fill(array, value, start, end) { - const length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { - start = 0; - end = length; - } - return baseFill(array, value, start, end); -} - -export default fill; diff --git a/findIndex.js b/findIndex.js deleted file mode 100644 index 39c099e61..000000000 --- a/findIndex.js +++ /dev/null @@ -1,41 +0,0 @@ -import baseFindIndex from './.internal/baseFindIndex.js'; -import toInteger from './toInteger.js'; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -const nativeMax = Math.max; - -/** - * This method is like `find` except that it returns the index of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @since 1.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @see find, findKey, findLast, findLastIndex, findLastKey - * @example - * - * const users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * findIndex(users, ({ user }) => user == 'barney'); - * // => 0 - */ -function findIndex(array, predicate, fromIndex) { - const length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - let index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseFindIndex(array, predicate, index); -} - -export default findIndex; diff --git a/isInteger.js b/isInteger.js deleted file mode 100644 index c37487e69..000000000 --- a/isInteger.js +++ /dev/null @@ -1,32 +0,0 @@ -import toInteger from './toInteger.js'; - -/** - * Checks if `value` is an integer. - * - * **Note:** This method is based on - * [`Number.isInteger`](https://mdn.io/Number/isInteger). - * - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an integer, else `false`. - * @see isNumber, toInteger, toNumber - * @example - * - * isInteger(3); - * // => true - * - * isInteger(Number.MIN_VALUE); - * // => false - * - * isInteger(Infinity); - * // => false - * - * isInteger('3'); - * // => false - */ -function isInteger(value) { - return typeof value == 'number' && value == toInteger(value); -} - -export default isInteger; diff --git a/isSafeInteger.js b/isSafeInteger.js deleted file mode 100644 index 24b67d22d..000000000 --- a/isSafeInteger.js +++ /dev/null @@ -1,35 +0,0 @@ -import isInteger from './isInteger.js'; - -/** Used as references for various `Number` constants. */ -const MAX_SAFE_INTEGER = 9007199254740991; - -/** - * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 - * double precision number which isn't the result of a rounded unsafe integer. - * - * **Note:** This method is based on - * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). - * - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. - * @example - * - * isSafeInteger(3); - * // => true - * - * isSafeInteger(Number.MIN_VALUE); - * // => false - * - * isSafeInteger(Infinity); - * // => false - * - * isSafeInteger('3'); - * // => false - */ -function isSafeInteger(value) { - return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; -} - -export default isSafeInteger; diff --git a/toPairs.js b/toPairs.js deleted file mode 100644 index fbed879cd..000000000 --- a/toPairs.js +++ /dev/null @@ -1,40 +0,0 @@ -import arrayMap from './.internal/arrayMap.js'; -import getTag from './.internal/getTag.js'; -import mapToArray from './.internal/mapToArray.js'; -import setToPairs from './.internal/setToPairs.js'; -import keys from './keys.js'; - -/** - * Creates an array of own enumerable string keyed-value pairs for `object` - * which can be consumed by `fromPairs`. If `object` is a map or set, its - * entries are returned. - * - * @since 4.0.0 - * @alias entries - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * toPairs(new Foo); - * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) - */ -function toPairs(object) { - const tag = getTag(object); - if (tag == '[object Map]') { - return mapToArray(object); - } - if (tag == '[object Set]') { - return setToPairs(object); - } - return arrayMap(keys(object), key => [key, object[key]]); -} - -export default toPairs;