DataField: a library to wrangle your data — Feedback wanted

DataField: a library to wrangle your data — Feedback wanted
0

#1

So I have built a tiny (2k gzip) library to wrangle your arrays of data as if it were a some kind of database requests to make life easier

Imagine you are building a web application that deals with users. You make an API request and receive an array of 100 entries which look like this one below:

data :[{
      "_id": "5b420ae94fe6464ff91f5de8",
      "index": 0,
      "guid": "871eebf0-9983-4eb5-a0b5-59372a2fbecd",
      "isActive": true,
      "balance": "$1,268.06",
      "age": 41,
      "name": {
        "first": "Pearlie",
        "last": "Osborne"
      },
      "company": "PIVITOL",
      "email": "pearlie.osborne@pivitol.net",
      "phone": "+1 (992) 418-2307",
      "address": "190 River Street, Spelter, Tennessee, 1088",
      "registered": "Monday, April 18, 2016 7:35 AM",
      "tags": ["ad", "magna", "aliqua"],
      "friends": [{"id": 0, "name": "Whitney Snow"}, {"id": 1, "name": "Garza Hernandez"}, {"id": 2,"name": "Lourdes Conley"}]
    }]

Now lets say we need users who are 30 years old or older, but not 41 years old and have at least 2 friends, but less than 10. Also we want our list sorted by last name in descending order. After that we are done so we want an array out of that:

const users = new DataField(data)

and then we can do something like:

users.where('age').gte(30).not(41).where('friends').range(2, 10).sort({by: 'name.last', order: 'desc'})

I tried to keep API as simple and short as possible.

A feedback would be really appreciated