Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lodash.concat

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.concat - npm Package Compare versions

Comparing version 4.1.1 to 4.2.0

94

index.js
/**
* lodash 4.1.1 (Custom Build) <https://lodash.com/>
* lodash 4.2.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
var baseFlatten = require('lodash._baseflatten'),
rest = require('lodash.rest');
var baseFlatten = require('lodash._baseflatten');

@@ -37,2 +36,21 @@ /**

/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function copyArray(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
/**
* Creates a new array concatenating `array` with any additional arrays

@@ -43,2 +61,3 @@ * and/or values.

* @memberOf _
* @since 4.0.0
* @category Array

@@ -59,11 +78,58 @@ * @param {Array} array The array to concatenate.

*/
var concat = rest(function(array, values) {
if (!isArray(array)) {
array = array == null ? [] : [Object(array)];
function concat() {
var length = arguments.length,
array = castArray(arguments[0]);
if (length < 2) {
return length ? copyArray(array) : [];
}
values = baseFlatten(values, 1);
return arrayConcat(array, values);
});
var args = Array(length - 1);
while (length--) {
args[length - 1] = arguments[length];
}
return arrayConcat(array, baseFlatten(args, 1));
}
/**
* Casts `value` as an array if it's not one.
*
* @static
* @memberOf _
* @since 4.4.0
* @category Lang
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast array.
* @example
*
* _.castArray(1);
* // => [1]
*
* _.castArray({ 'a': 1 });
* // => [{ 'a': 1 }]
*
* _.castArray('abc');
* // => ['abc']
*
* _.castArray(null);
* // => [null]
*
* _.castArray(undefined);
* // => [undefined]
*
* _.castArray();
* // => []
*
* var array = [1, 2, 3];
* console.log(_.castArray(array) === array);
* // => true
*/
function castArray() {
if (!arguments.length) {
return [];
}
var value = arguments[0];
return isArray(value) ? value : [value];
}
/**
* Checks if `value` is classified as an `Array` object.

@@ -73,6 +139,8 @@ *

* @memberOf _
* @since 0.1.0
* @type {Function}
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @returns {boolean} Returns `true` if `value` is correctly classified,
* else `false`.
* @example

@@ -79,0 +147,0 @@ *

5

package.json
{
"name": "lodash.concat",
"version": "4.1.1",
"version": "4.2.0",
"description": "The lodash method `_.concat` exported as a module.",

@@ -18,5 +18,4 @@ "homepage": "https://lodash.com/",

"dependencies": {
"lodash._baseflatten": "~4.1.0",
"lodash.rest": "^4.0.0"
"lodash._baseflatten": "~4.1.0"
}
}

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

# lodash.concat v4.1.1
# lodash.concat v4.2.0

@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.concat` exported as a [Node.js](https://nodejs.org/) module.

See the [documentation](https://lodash.com/docs#concat) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.concat) for more details.
See the [documentation](https://lodash.com/docs#concat) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.concat) for more details.

Sorry, the diff of this file is not supported yet

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