1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 15:36:22 -04:00
jarv.is/lib/styles/utils/hex-to-rgba.ts

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;