Closed selfup closed 6 years ago
Implement ONLY query that takes keys which then returns values in order of the keys.
ONLY
keys
values
Examples in JavaScript:
const query = 'ONLY'; const keys = ['color']; axios.get('http://whatever.com/api/cmd', { data: { query, keys, }, }) .then(...) .catch(...);
The response will be:
{ values: ['blue'], }
So now if you want to build an object based off the response, something simple like:
const newObj = {}; keys.forEach((key, i) => newObj[key] = values[i]);
Considering just returning a valid object..
Implement
ONLY
query that takeskeys
which then returnsvalues
in order of the keys.Examples in JavaScript:
The response will be:
So now if you want to build an object based off the response, something simple like:
Considering just returning a valid object..