array-to-object-with-property-names-that-map-to-array-values-and-property-values-that-are-objects-with-keys-whose-values-also-map-to-array-values

1.0.0 • Public • Published

array-to-object-with-property-names-that-map-to-array-values-and-property-values-that-are-objects-with-keys-whose-values-also-map-to-array-values

Convert an array to an object whose property names map to the array items, and whose values are objects whose properties in turn you can specify, and those property values are also mapped to the current array item.

Example

var arrayToObjectWithPropertyNamesThatMapToArrayValuesAndPropertyValuesThatAreObjectsWithKeysWhoseValuesAlsoMapToArrayValues = require('array-to-object-with-property-names-that-map-to-array-values-and-property-values-that-are-objects-with-keys-whose-values-also-map-to-array-values');

arrayToObjectWithPropertyNamesThatMapToArrayValuesAndPropertyValuesThatAreObjectsWithKeysWhoseValuesAlsoMapToArrayValues(['foo', 'bar'], ['name', 'id']);

// Result:
// {
//   foo: {name: 'foo', id: 'foo'},
//   bar: {name: 'bar', id: 'bar'},
// }

License

ISC

/array-to-object-with-property-names-that-map-to-array-values-and-property-values-that-are-objects-with-keys-whose-values-also-map-to-array-values/

    Package Sidebar

    Install

    npm i array-to-object-with-property-names-that-map-to-array-values-and-property-values-that-are-objects-with-keys-whose-values-also-map-to-array-values

    Weekly Downloads

    4

    Version

    1.0.0

    License

    ISC

    Last publish

    Collaborators

    • lxe