MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getPlurals

Function getPlurals

scripts/generateAllPlurals.mjs:56–77  ·  view source on GitHub ↗
(tr, range)

Source from the content-addressed store, hash-verified

54}
55
56function getPlurals(tr, range) {
57 let columnTitles = [...tr.childNodes].map(td => td.title);
58 let rules = Object.fromEntries(columnTitles.map(key => [key, []]));
59
60 let td = tr.firstElementChild;
61
62 let index = 1;
63
64 do {
65 const category = td.title;
66
67 let columns = td.hasAttribute('colspan') ? Number(td.getAttribute('colspan')) : 1;
68
69 do {
70 rules[category].push(range[index]);
71
72 index++;
73 } while (columns-- > 1);
74 } while ((td = td.nextElementSibling));
75
76 return rules;
77}
78
79function extractTable(dom, integerTable, fractionTable) {
80 function extract(table) {

Callers 1

extractFunction · 0.85

Calls 2

hasAttributeMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected