Object.objectify >= 0.1.0

Purpose

Convert an array into an object

Syntax

Object.objectify ( Arraysource Booleanrecursive= false value );


Parameters

source
recursive
value
Default value when array entry is not an object

Return values

Object

Examples

Convert the output of `Object.divide` back into an object

// Object.divide turns an object into an array
var arr = Object.divide({a: 1, b: 2});>>> [{a: 1}, {b: 2}]

// Now re-merge it
Object.objectify(arr);>>> {a: 1, b: 2}

Convert an array of non-object values

Object.objectify(['a', 'b', 'c']);>>> { a: true, b: true, c: true }

Set the value to use for non-object entries

Object.objectify(['a', 'b', 'c'], null, 'myvalue');>>> { a: "myvalue", b: "myvalue", c: "myvalue" }