Mapper

Stability: 2 - Stable

const Mapper = require('kado/lib/Mapper')

The Mapper library provides a functional interface for Object handling.

Class: Mapper

Mapper is a general-purpose Object handling toolkit. Some functions are static and may be used as shortcuts rather than creating a full instance.

static Mapper.getInstance (data)

Mapper.constructor (data)

Instantiates a new empty Mapper instance, optionally populated with data

Mapper.map (iterator)

Example

const someObject = { foo: 'baz', two: 2, three: null }
Mapper.getInstance(someObject).map((value, key) => {
  if (value === null) value = ''
  return value
})

Mapper.merge (data)

Mapper.get (key)

Mapper.set (key, value)

Mapper.delete (key)

Mapper.all ()


Static (stateless) functions

static Mapper.mergeObject (base, overlay, depth, maxDepth)

static Mapper.getFromObject (base, keyArray)

static Mapper.setToObject (base, keyArray, value)

static Mapper.deleteFromObject (base, keyArray, ctx = null)

static Mapper.parseKey (key)