Is extra lightweight implementation of Query Language for web applications. It supports direct fields only without any extra behavior.
Let's select all friends props for user:
{
user {
name, friends{*}
}
}
Each entity has required fields which will be returned in any way, such an ID,
so there is no reason to specify them. If passed asterisk {*}
then all
properties will be extracted.
Via npm:
npm i response-ql
const parse = require('response-ql');
parse('user{location}'); // -> Map {"user" => Map {"location" => null}}
parse.parse('user{location}'); // -> [{name: 'user', props:[{name: 'location', props: null}]}]
Example output:
[{
name: 'user',
props: [{
name: 'location',
props: null
}]
}]
When properties follow in one line it should be separated with comma.
user{name, email, birthday, city, cars{*}}
When properties separated with new line, comma could be omitted:
user {
name, email
birthday
city
cars{*}
}
MIT.