Skip to content Skip to sidebar Skip to footer

Map Multiple Keys With Lowdb

In lowdb for Node.js, if I have a DB JSON like [ { 'foo': 'bar1', 'tar': 'ball1', 'data': [ { 'a': 1 },

Solution 1:

If data is JSON, why not just use array.map()? As such:

var data = db.get('test');

var dataSelection = data.map(e => {
  return { foo: e.foo, a: data[0].a };
});

Post a Comment for "Map Multiple Keys With Lowdb"