1.0.0 • Published 8 years ago

join-maps v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

join-maps

Requires Node 4.x or newer

npm install join-maps

Concatenates multiple Maps into one Map. Duplicate values are overriden with each successive map.

import joinMaps from 'join-maps'

const A = new Map([
    [1, 'one'],
    [2, 'two'],
    [3, 'three']
])

const B = new Map([
    [3, 'could be 3'],
    [4, 'four']
])

const C = new Map([
    [5, 'five'],
    [3, 'not really 3']
])

const D = joinMaps(A, B, C)

/*
    D is now Map {
      1 => 'one',
      2 => 'two',
      3 => 'not really 3',
      4 => 'four',
      5 => 'five'
    }
 */