amzn / style-dictionary

A build system for creating cross-platform styles.
https://styledictionary.com
Apache License 2.0
3.93k stars 558 forks source link

fix: filterTokens util to support random metadata props #1354

Closed jorenbroekema closed 1 month ago

jorenbroekema commented 1 month ago

Issue #, if available: https://github.com/amzn/style-dictionary/pull/1347

Description of changes: Fix assumption that "token" is defined, where it may also be null or undefined or similar, which would throw if you attempt to access a property on it.

@mjmonline I created a PR based on yours and committed with you as co-author. I improved the test a bit more and also slightly refactored the offending code so it makes a bit more sense and is a bit more readable. Not that your PR wasn't valid or anything, it was good so thanks for contributing it :) but this cleans things up a little bit as well in addition to that.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

aws-amplify-us-west-1[bot] commented 1 month ago

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1354.d16eby4ekpss5y.amplifyapp.com

mjmonline commented 1 month ago

@jorenbroekema @dbanksdesign Too bad the co-authoring got lost in the merge :(

jorenbroekema commented 1 month ago

Wow I've never seen that before, not sure why that happened :( there's another commit (by someone else) that was also merged by PR with co-author and that one works and is still in the commit history :|

mjmonline commented 1 month ago

@jorenbroekema could be because of squash merge and the final commit body did not include the co-author tagging