Socket
Socket
Sign inDemoInstall

lodash-es

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash-es - npm Package Compare versions

Comparing version 4.16.1 to 4.16.2

_baseSample.js

3

_arraySample.js
import baseRandom from './_baseRandom.js';
/**
* A specialized version of `_.sample` for arrays without support for iteratee
* shorthands.
* A specialized version of `_.sample` for arrays.
*

@@ -7,0 +6,0 @@ * @private

@@ -1,3 +0,3 @@

import arrayShuffle from './_arrayShuffle.js';
import baseClamp from './_baseClamp.js';
import copyArray from './_copyArray.js';
import shuffleSelf from './_shuffleSelf.js';

@@ -13,7 +13,5 @@ /**

function arraySampleSize(array, n) {
var result = arrayShuffle(array);
result.length = baseClamp(n, 0, result.length);
return result;
return shuffleSelf(copyArray(array), n);
}
export default arraySampleSize;

@@ -11,9 +11,21 @@ import isObject from './isObject.js';

* @private
* @param {Object} prototype The object to inherit from.
* @param {Object} proto The object to inherit from.
* @returns {Object} Returns the new object.
*/
function baseCreate(proto) {
return isObject(proto) ? objectCreate(proto) : {};
}
var baseCreate = (function() {
function object() {}
return function(proto) {
if (!isObject(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = prototype;
var result = new object;
object.prototype = undefined;
return result;
};
}());
export default baseCreate;

@@ -1,2 +0,2 @@

/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -3,0 +3,0 @@

@@ -0,1 +1,16 @@

import root from './_root.js';
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined,
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
/**

@@ -13,3 +28,5 @@ * Creates a clone of `buffer`.

}
var result = new buffer.constructor(buffer.length);
var length = buffer.length,
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result);

@@ -16,0 +33,0 @@ return result;

@@ -11,3 +11,3 @@ import LodashWrapper from './_LodashWrapper.js';

/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -14,0 +14,0 @@

@@ -12,3 +12,3 @@ import baseSetData from './_baseSetData.js';

/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -15,0 +15,0 @@

@@ -0,11 +1,13 @@

import baseClamp from './_baseClamp.js';
import baseRandom from './_baseRandom.js';
/**
* A specialized version of `arrayShuffle` which mutates `array`.
* A specialized version of `_.shuffle` which mutates and sets the size of `array`.
*
* @private
* @param {Array} array The array to shuffle.
* @param {number} [size=array.length] The size of `array`.
* @returns {Array} Returns `array`.
*/
function shuffleSelf(array) {
function shuffleSelf(array, size) {
var index = -1,

@@ -15,3 +17,4 @@ length = array.length,

while (++index < length) {
size = size === undefined ? length : baseClamp(size, 0, length);
while (++index < size) {
var rand = baseRandom(index, lastIndex),

@@ -23,2 +26,3 @@ value = array[rand];

}
array.length = size;
return array;

@@ -25,0 +29,0 @@ }

import toInteger from './toInteger.js';
/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -5,0 +5,0 @@

import toInteger from './toInteger.js';
/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -5,0 +5,0 @@

@@ -6,3 +6,3 @@ import apply from './_apply.js';

/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -9,0 +9,0 @@

@@ -5,3 +5,3 @@ import isObject from './isObject.js';

/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -8,0 +8,0 @@

import baseIsNative from './_baseIsNative.js';
import isMaskable from './_isMaskable.js';
/** Error message constants. */
var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://github.com/es-shims.';
/**

@@ -32,3 +35,3 @@ * Checks if `value` is a pristine native function.

if (isMaskable(value)) {
throw new Error('This method is not supported with core-js. Try https://github.com/es-shims.');
throw new Error(CORE_ERROR_TEXT);
}

@@ -35,0 +38,0 @@ return baseIsNative(value);

@@ -48,3 +48,3 @@ /**

/** Used as the semantic version number. */
var VERSION = '4.16.1';
var VERSION = '4.16.2';

@@ -51,0 +51,0 @@ /** Used to compose bitmasks for function metadata. */

import MapCache from './_MapCache.js';
/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -5,0 +5,0 @@

@@ -1,2 +0,2 @@

/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -3,0 +3,0 @@

{
"name": "lodash-es",
"version": "4.16.1",
"version": "4.16.2",
"description": "Lodash exported as ES modules.",

@@ -5,0 +5,0 @@ "keywords": "es6, modules, stdlib, util",

import root from './_root.js';
import toString from './toString.js';
/** Used to match leading and trailing whitespace. */
var reTrimStart = /^\s+/;
/* Built-in method references for those with the same name as other `lodash` methods. */

@@ -37,5 +40,5 @@ var nativeParseInt = root.parseInt;

}
return nativeParseInt(toString(string), radix || 0);
return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
}
export default parseInt;

@@ -1,2 +0,2 @@

# lodash-es v4.16.1
# lodash-es v4.16.2

@@ -10,2 +10,2 @@ The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.

See the [package source](https://github.com/lodash/lodash/tree/4.16.1-es) for more details.
See the [package source](https://github.com/lodash/lodash/tree/4.16.2-es) for more details.
import baseRest from './_baseRest.js';
import toInteger from './toInteger.js';
/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -6,0 +6,0 @@

import arraySample from './_arraySample.js';
import isArrayLike from './isArrayLike.js';
import values from './values.js';
import baseSample from './_baseSample.js';
import isArray from './isArray.js';

@@ -20,5 +20,6 @@ /**

function sample(collection) {
return arraySample(isArrayLike(collection) ? collection : values(collection));
var func = isArray(collection) ? arraySample : baseSample;
return func(collection);
}
export default sample;
import arraySampleSize from './_arraySampleSize.js';
import isArrayLike from './isArrayLike.js';
import baseSampleSize from './_baseSampleSize.js';
import isArray from './isArray.js';
import isIterateeCall from './_isIterateeCall.js';
import toInteger from './toInteger.js';
import values from './values.js';

@@ -33,5 +33,6 @@ /**

}
return arraySampleSize(isArrayLike(collection) ? collection : values(collection), n);
var func = isArray(collection) ? arraySampleSize : baseSampleSize;
return func(collection, n);
}
export default sampleSize;

@@ -1,5 +0,4 @@

import copyArray from './_copyArray.js';
import isArrayLike from './isArrayLike.js';
import shuffleSelf from './_shuffleSelf.js';
import values from './values.js';
import arrayShuffle from './_arrayShuffle.js';
import baseShuffle from './_baseShuffle.js';
import isArray from './isArray.js';

@@ -22,8 +21,6 @@ /**

function shuffle(collection) {
return shuffleSelf(isArrayLike(collection)
? copyArray(collection)
: values(collection)
);
var func = isArray(collection) ? arrayShuffle : baseShuffle;
return func(collection);
}
export default shuffle;

@@ -7,3 +7,3 @@ import apply from './_apply.js';

/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -10,0 +10,0 @@

import debounce from './debounce.js';
import isObject from './isObject.js';
/** Used as the `TypeError` message for "Functions" methods. */
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';

@@ -6,0 +6,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc