conductor
Why I'm building conductorGitHub
v1.5.0
v1.5.0
  • Introduction
  • Overview
    • Introduction
    • Core concepts
  • API reference
    • always
    • append
    • apply
    • arity
    • branch
    • capitalize
    • compose
    • concat
    • curry
    • curryN
    • delay
    • dump
    • entries
    • equals
    • equalsBy
    • factory
    • filter
    • findIndex
    • flatten
    • flip
    • forEach
    • get
    • head
    • ifElse
    • identity
    • into
    • isPromise
    • iterate
    • join
    • keys
    • map
    • merge
    • mergeBy
    • next
    • not
    • pluck
    • prepend
    • random
    • reduce
    • replace
    • slice
    • some
    • split
    • take
    • then
    • toLowerCase
    • transduce
    • transformers
      • transformers/filter
      • transformers/map
    • type
    • upsert
    • values
  • Guides
    • example use cases
    • checkGuards
Powered by GitBook
On this page
  • description
  • examples
  1. API reference

concat

PreviouscomposeNextcurry

Last updated 6 years ago

concat :: (A, A) -> A

description

Concatenate two elements of the same type: Arrays, Objects, Sets, Maps, Strings... without intentionally deduping elements: Arrays will be concatenated and may contain duplicates, Objects and Maps will be merged, and Sets will be concatenated without duplicates because Sets themselves can not contain duplicate elements.

concat will use the if it has no better option with the input type you provided.

examples

arrays

import { concat } from 'conductor'

const a = [1, 2]
const b = [2, 3]
concat(a, b) // [1, 2, 2, 3]

objects

import { concat } from 'conductor'

const a = { hello: 'Bonsoir', world: 'world' }
const b = { world: 'Elliot' }
concat(a, b) // { hello: 'Bonsoir, world: 'Elliot' }

strings

import { concat } from 'conductor'

const a = 'Bonsoir, '
const b = 'Elliot'
concat(a, b) // 'Bonsoir, Elliot'

sets

import { concat } from 'conductor'

const a = new Set([1, 2])
const b = new Set([2, 3])
concat(a, b) // Set {1, 2, 3}
addition operator