Package Exports
- object-concat
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (object-concat) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
object-concat

Assigns properties of source object(s) to a new object.
npm install
npm install object-concat --savenpm stats
Example
basic
var concat = require('object-concat');
var defaults = { level: 1 }
var restored = { player: 'isaac', level: 5 }
var gamedata = concat(defaults, restored)
assert.equal(gamedata.player, 'isaac')
//=> undefined
assert.equal(gamedata.level, 5)
//=> undefined
assert.notDeepEqual(gamedata, defaults)
//=> undefined
assert.notDeepEqual(gamedata, restored)
//=> undefinedtransform
var concat = require('object-concat');
var defaults = { level: 1 }
var restored = { player: 'isaac', level: 5 }
var gamedata = concat(defaults, restored, function (key, targetVal, sourceVal) {
return key === 'player' ? sourceVal.toUpperCase() : sourceVal
})
assert.equal(gamedata.player, 'ISAAC')
//=> undefinedFeatures
- Return a new object (does not mutate a
targetobject likeObject.assignor_.{assign,extend}). - Subsequent source properties overwrite previous.
- Supports optional
iterateefunction allowing transformation of target values.
Anti-Features
- Will never mutate existing objects.
- Will never overwrite existing
Objectmethods (i.e.Object.assign).
API
concat([sources], [iteratee])
Arguments
[sources]: (…Object)The source objects.[iteratee]: (Function)Function that produces desired target value (must be last parameter).key: (String)Object key name.targetVal: (*)Object target value.sourceVal: (*)Object source value.
Returns
(Object)The new object.
Alternatives
Most, if not all of the alternatives listed have varying semantics so be careful which you choose for your own applications.