style-dictionary-utils
Version:
Utilities to use in your style dictionary config
17 lines (16 loc) • 553 B
JavaScript
import { isDeprecated } from '../filter/isDeprecated.js';
/**
* commentDeprecated
* @description replaces the comment of a token with the deprecated comment
*/
export const commentDeprecated = {
name: 'comment/deprecated',
type: `attribute`,
transitive: true,
filter: isDeprecated,
transform: (token) => {
const deprecated = token.deprecated || token.$deprecated;
token.$description = `DEPRECATED${typeof deprecated === 'string' && deprecated !== 'true' ? `: ${deprecated}` : ''}`;
return token;
},
};