MCPcopy
hub / github.com/bahmutov/code-snippets / keysVsValues

Function keysVsValues

keys-vs-values.js:41–56  ·  view source on GitHub ↗
(items)

Source from the content-addressed store, hash-verified

39 }
40
41 function keysVsValues(items) {
42 if (!Array.isArray(items) && typeof items === 'object') {
43 return keysVsValues([items]);
44 }
45
46 console.assert(Array.isArray(items));
47 return items.reduce(function (sizes, item) {
48 var size = keysValues(item);
49 sizes.keys += size.keys;
50 sizes.values += size.values;
51 return sizes;
52 }, {
53 keys: 0,
54 values: 0
55 });
56 }
57
58 root.keysVsValues = keysVsValues;
59 console.log('try keysVsValues(<array of objects>);');

Callers

nothing calls this directly

Calls 1

keysValuesFunction · 0.85

Tested by

no test coverage detected