UNPKG

json-indexify

Version:

[![Build Status](https://travis-ci.org/prateekpronoc/json-indexify.svg?branch=master)](https://travis-ci.org/prateekpronoc/json-indexify) [![Coverage Status](https://coveralls.io/repos/github/prateekpronoc/json-indexify/badge.svg?branch=master)](https://c

12 lines (10 loc) 427 B
'use strict'; var expect = require('chai').expect; var indexify = require('../index'); describe('#IndexifyArrayOfJSONObject', function() { it('should convert array to json object by property names', function() { var result = indexify([{ id: 91, value: 'India' }, { id: 1, value: 'USA' }], 'id', 'value'); console.log(result); expect(result).to.deep.equal({'1': 'USA', '91': 'India' }); }); });