Skip to content

Commit

Permalink
fix: add support for class names which are keys from object prototype
Browse files Browse the repository at this point in the history
This commit fixes an issue in astToUsedStyles, that would crash if it
received a class name which also was a function in the Object.prototype
eg. "toString".
  • Loading branch information
nickolaj-jepsen committed Dec 8, 2022
1 parent cb432b1 commit ed2d5f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/getCSS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export const astToUsedStyles = kashe((styles: string[], def: StyleDefinition) =>
const classes = className.split(' ');

classes.forEach((singleClass) => {
const files = lookup[singleClass];
if (lookup.hasOwnProperty(singleClass)) {
const files = lookup[singleClass];

if (files) {
files.forEach((file) => {
if (!fetches[file]) {
fetches[file] = {};
Expand Down

0 comments on commit ed2d5f9

Please sign in to comment.