mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 15:16:21 -04:00
10 lines
371 B
TypeScript
10 lines
371 B
TypeScript
import hexToRgba from "hex-to-rgba";
|
|
import mem from "mem";
|
|
|
|
// removes spaces from default hex-to-rgba output and caches the result
|
|
const memoized = mem((color: string, alpha?: number) => hexToRgba(color, alpha).replace(/\s/g, ""), {
|
|
cacheKey: (arguments_) => arguments_.join(","), // https://github.com/sindresorhus/mem#caching-strategy
|
|
});
|
|
|
|
export default memoized;
|