style-dictionary icon indicating copy to clipboard operation
style-dictionary copied to clipboard

Make utilities for handling tokens pure

Open jorenbroekema opened this issue 1 year ago • 0 comments

But to make function totally pure you should use full clone instead of just shallow clone. Because current behavior allow of update for example subproperties of token, i.e attributes, properties of object values etc.

Originally posted by @Delagen in https://github.com/amzn/style-dictionary/pull/1397#discussion_r1881684802

More context: the flattenTokens utility and the convertTokenData utility, and probably others, need to make sure to created deep clones of the input if the input is of a data type where you might accidentally be mutating the input.

jorenbroekema avatar Dec 12 '24 09:12 jorenbroekema