1.0.2 • Published 2 years ago

concat-elements v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Description

concat-elements is an alternative to concat elements in one array.

you can concat strings, number, boolean, arrays and objects similary to default method concat of ECMA 262

Installation

npm

npm install concat-elements

Sample

const concatElements = require("concat-elements");

let food = ["🍔", "🍕", "🍖", "🍗"];
let animals = ["🐜", "🐅", "🐆", "🦙"];

const array = concatElements(1, "s", food, animals, { name: "test" });

//output:  [ 1, 's', '🍔', '🍕', '🍖', '🍗','🐜','🐅','🐆','🦙', { name: 'test' }]

Syntax

concatElements(element1[, element2[, ...[, elementN]]]);

Performance

concat-elements vs concat ecma

sample of time in 1000 iterations

concat-elements:

Example with concat-elements.

concat:

Example with concat.

Keywords