All files / src/theme/v2 utils.ts

100% Statements 8/8
100% Branches 0/0
100% Functions 4/4
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18      548x   4460920x     548x 886366x   886366x     548x 664890x    
import jsonTokens from "./color.tokens.json";
import { ThemeVersions } from "@theme/v2/types";
 
const getJsonObject = (key: string): any => {
  // Here you retrive nested values
  return key.split(".").reduce((acc: any, part: any) => acc[part], jsonTokens);
};
 
export const getJsonValue = (key: string): string => {
  const obj = getJsonObject(key);
 
  return obj?.value;
};
 
export const isSecondVersion = (value?: ThemeVersions) => {
  return value === "two";
};