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

Function getUniqueVars

lib/vars.js:35–53  ·  view source on GitHub ↗
(vars)

Source from the content-addressed store, hash-verified

33
34// Find variables with unique values, and create a mapping between them.
35function getUniqueVars(vars) {
36 let unique = {};
37 for (let key in vars) {
38 if (!unique[vars[key]]) {
39 unique[vars[key]] = [key];
40 } else {
41 unique[vars[key]].push(key);
42 }
43 }
44
45 let mappings = {};
46 for (let val in unique) {
47 for (let key of unique[val]) {
48 mappings[key] = unique[val];
49 }
50 }
51
52 return mappings;
53}
54
55// Get unique variables, static variables, and a mapping of original variable names.
56function getVariableMappings(themes) {

Callers 1

getVariableMappingsFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected