mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Add basic _#concat test.
This commit is contained in:
@@ -6076,14 +6076,14 @@
|
|||||||
* @returns {Array} Returns the new concatenated array.
|
* @returns {Array} Returns the new concatenated array.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var array = [1, 2];
|
* var array = [1];
|
||||||
* var wrapped = _(array).concat([3], 4);
|
* var wrapped = _(array).concat(2, [3], [[4]]);
|
||||||
*
|
*
|
||||||
* console.log(wrapped.value());
|
* console.log(wrapped.value());
|
||||||
* // => [1, 2, 3, 4]
|
* // => [1, 2, 3, [4]]
|
||||||
*
|
*
|
||||||
* console.log(array);
|
* console.log(array);
|
||||||
* // => [1, 2]
|
* // => [1]
|
||||||
*/
|
*/
|
||||||
var wrapperConcat = restParam(function(values) {
|
var wrapperConcat = restParam(function(values) {
|
||||||
values = baseFlatten(values);
|
values = baseFlatten(values);
|
||||||
|
|||||||
13
test/test.js
13
test/test.js
@@ -17173,6 +17173,19 @@
|
|||||||
QUnit.module('lodash(...).concat');
|
QUnit.module('lodash(...).concat');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
test('should concat arrays and values', 2, function() {
|
||||||
|
if (!isNpm) {
|
||||||
|
var array = [1],
|
||||||
|
wrapped = _(array).concat(2, [3], [[4]]);
|
||||||
|
|
||||||
|
deepEqual(wrapped.value(), [1, 2, 3, [4]]);
|
||||||
|
deepEqual(array, [1]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipTest(2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('should treat sparse arrays as dense', 3, function() {
|
test('should treat sparse arrays as dense', 3, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var expected = [],
|
var expected = [],
|
||||||
|
|||||||
Reference in New Issue
Block a user