@primer/primitives
Version:
Typography, spacing, and color primitives for Primer design system
14 lines (13 loc) • 454 B
JavaScript
/**
* checks if all required properties exist on token
* @param object - tokenValue
* @param array - property names
* @returns void or throws error
*/
export const checkRequiredTokenProperties = (tokenValue, requiredProperties) => {
for (const prop of requiredProperties) {
if (prop in tokenValue === false) {
throw new Error(`Missing property: ${prop} on token with value ${JSON.stringify(tokenValue)}`);
}
}
};