style-dictionary-utils
Version:
Utilities to use in your style dictionary config
20 lines (19 loc) • 562 B
JavaScript
import { getValue } from '../utilities/getValue.js';
/**
* @name isClamp
* @type filter
* @description only returns tokens of type `shadow`
*/
export const isClampFilter = (token) => {
const tokenValue = getValue(token);
return ((token === null || token === void 0 ? void 0 : token.$type) === 'clamp' &&
tokenValue !== null &&
typeof tokenValue === 'object' &&
'min' in tokenValue &&
'ideal' in tokenValue &&
'max' in tokenValue);
};
export const isClamp = {
name: 'isClamp',
filter: isClampFilter,
};