Skip to content

Commit

Permalink
fix: fix empty object error (#4903)
Browse files Browse the repository at this point in the history
Co-authored-by: zhongcheng <zhongcheng@bytedance.com>
  • Loading branch information
xzfd1010 and zhongcheng committed Sep 1, 2021
1 parent 267f20c commit 911e755
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/plugins/animation.js
Expand Up @@ -4,7 +4,7 @@ export default function () {
return function ({ matchUtilities, theme, variants, prefix }) {
let prefixName = (name) => prefix(`.${name}`).slice(1)
let keyframes = Object.fromEntries(
Object.entries(theme('keyframes')).map(([key, value]) => {
Object.entries(theme('keyframes') || {}).map(([key, value]) => {
return [
key,
[
Expand Down
2 changes: 1 addition & 1 deletion src/util/createUtilityPlugin.js
Expand Up @@ -36,7 +36,7 @@ export default function createUtilityPlugin(
{
values: filterDefault
? Object.fromEntries(
Object.entries(theme(themeKey)).filter(([modifier]) => modifier !== 'DEFAULT')
Object.entries(theme(themeKey) || {}).filter(([modifier]) => modifier !== 'DEFAULT')
)
: theme(themeKey),
variants: variants(themeKey),
Expand Down
2 changes: 1 addition & 1 deletion src/util/flattenColorPalette.js
@@ -1,7 +1,7 @@
const flattenColorPalette = (colors) =>
Object.assign(
{},
...Object.entries(colors).flatMap(([color, values]) =>
...Object.entries(colors || {}).flatMap(([color, values]) =>
typeof values == 'object'
? Object.entries(flattenColorPalette(values)).map(([number, hex]) => ({
[color + (number === 'DEFAULT' ? '' : `-${number}`)]: hex,
Expand Down
2 changes: 1 addition & 1 deletion src/util/processPlugins.js
Expand Up @@ -106,7 +106,7 @@ export default function (plugins, config) {
prefix: applyConfiguredPrefix,
addUtilities,
matchUtilities: (matches, { values, variants, respectPrefix, respectImportant }) => {
let modifierValues = Object.entries(values)
let modifierValues = Object.entries(values || {})

let result = Object.entries(matches).flatMap(([name, utilityFunction]) => {
return modifierValues
Expand Down

0 comments on commit 911e755

Please sign in to comment.