mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-10-24 22:56:23 -04:00
cache hex-to-rgba outputs
This commit is contained in:
6 files changed
+281
-267
No files matched your search
@@ -0,0 +1,9 @@
|
||||
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;
|
||||
Reference in new issue
Block a user