MCPcopy Create free account
hub / github.com/bendc/animateplus / hexPairs

Function hexPairs

animateplus.js:108–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106// ================
107
108const hexPairs = color => {
109 const split = color.split("");
110 const pairs = color.length < 5
111 ? split.map(string => string + string)
112 : split.reduce((array, string, index) => {
113 if (index % 2)
114 array.push(split[index - 1] + string);
115 return array;
116 }, []);
117 if (pairs.length < 4)
118 pairs.push("ff");
119 return pairs;
120};
121
122const convert = color =>
123 hexPairs(color).map(string => parseInt(string, 16));

Callers 1

convertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected