You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Map over an object, and create a new object with the entry `{ key, value }` returned by the callback for every input entry.
310
+
311
+
```text
312
+
mapObject(callback)
313
+
```
314
+
315
+
Example:
316
+
317
+
```js
318
+
constdata= { "a":2, "b":3 }
319
+
jsonquery(data, `mapObject({
320
+
key: (.key + " times two"),
321
+
value: (.value * 2)
322
+
})`)
323
+
// {
324
+
// "a times two": 4,
325
+
// "b times two": 6
326
+
// }
327
+
```
328
+
329
+
## mapKeys
330
+
331
+
Map over an object, and create a new object with the keys returned by the callback having the value of the original key.
332
+
333
+
```text
334
+
mapKeys(callback)
335
+
```
336
+
337
+
Example:
338
+
339
+
```js
340
+
constdata= { "a":2, "b":3 }
341
+
jsonquery(data, 'mapKeys("#" + get())')
342
+
// { "#a": 2, "#b": 3 }
343
+
```
344
+
345
+
## mapValues
346
+
347
+
Map over an object, and create a new object with the values updated by the return value of callback.
348
+
349
+
```text
350
+
mapValues(callback)
351
+
```
352
+
353
+
Example:
354
+
355
+
```js
356
+
constdata= { "a":2, "b":3 }
357
+
jsonquery(data, 'mapValues(get() * 2)')
358
+
// { "a": 4, "b": 6 }
359
+
```
360
+
291
361
## groupBy
292
362
293
363
Group a list with objects grouped by the value of given path. This creates an object with the different properties as key, and an array with all items having that property as value.
0 commit comments