MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / countBy

Function countBy

assets/js/scriptDetection/Script.js:44–56  ·  view source on GitHub ↗
(items, groupName)

Source from the content-addressed store, hash-verified

42}
43
44function countBy(items, groupName) {
45 let counts = [];
46 for (let item of items) {
47 let name = groupName(item);
48 let known = counts.findIndex((c) => c.name === name);
49 if (known == -1) {
50 counts.push({ name, count: 1 });
51 } else {
52 counts[known].count++;
53 }
54 }
55 return counts;
56}
57
58function characterScript(code) {
59 for (let script of SCRIPTS) {

Callers 1

textScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected