2.0.2 • Published 12 months ago
@hugoalh/concatenate v2.0.2
Concatenate (NodeJS)
Releases | Latest () | Pre () |
---|---|---|
📝 Description
A NodeJS module to concatenate multiple items into one item.
This project is separated from @hugoalh/more-method
's (GitHub)(NPM) function concatenate
.
📚 Documentation
Getting Started
- NodeJS ^ v12.20.0 || ^ v14.15.0 || >= v16.13.0
npm install @hugoalh/concatenate
import concatenate from "@hugoalh/concatenate";// Default Import
API
Function
concatenate<T>(...items: T[][]): T[];
concatenate<K, V>(...items: Map<K, V>[]): Map<K, V>;
concatenate<T>(...items: { [x: string]: T; }[]): { [x: string]: T; };
concatenate<T>(...items: Set<T>[]): Set<T>;
concatenate(...items: string[]): string;
Example
concatenate(["one", "two", "three"], ["four", "five", "six"]);
//=> ["one", "two", "three", "four", "five", "six"]
concatenate({ foo: "bar" }, { loo: "too" });
//=> { foo: "bar", loo: "too" }
concatenate({ foo: { bar: { baz: 1 }}}, { foo: { bar: { boo: 2 }}});
//=> { foo: { bar: { baz: 1, boo: 2 }}}