Skip to content

Commit

Permalink
perf: use reluctant RegExp matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Aug 1, 2020
1 parent 37b02a9 commit 7e6e53d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/otion/src/propertyMatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
*/

// Includes support for CSS custom properties
export const PROPERTY_ACCEPTS_UNITLESS_VALUES = /^(-|f[lo].*[^se]$|g.{6,}[^ps]$|z|o[pr]|(-w.{6})?li.*(t|mp)$|an|(bo|s).{5}im|sca|m.{7}[ds]|ta|c.*[st]$|wido|ini)/;
export const PROPERTY_ACCEPTS_UNITLESS_VALUES = /^(-|f[lo].*?[^se]$|g.{6,}[^ps]$|z|o[pr]|(-w.{6})?li.*?(t|mp)$|an|(bo|s).{5}im|sca|m.{7}[ds]|ta|c.*?[st]$|wido|ini)/;

// TODO: Add tests to match everything below, without false positives
export const propertiesAcceptingUnitlessValues = [
/* ^f[lo].*[^se]$ */
/* ^f[lo].*?[^se]$ */
"flex",
"flex-grow",
"flex-shrink",
Expand All @@ -37,7 +37,7 @@ export const propertiesAcceptingUnitlessValues = [
"order",
"orphans",

/* ^(-w.{6})?li.*(t|mp)$ */
/* ^(-w.{6})?li.*?(t|mp)$ */
"line-height",
"line-clamp",
"-webkit-line-clamp",
Expand Down Expand Up @@ -66,7 +66,7 @@ export const propertiesAcceptingUnitlessValues = [
/* ^ta */
"tab-size",

/* ^c.*[st]$ */
/* ^c.*?[st]$ */
"columns",
"column-count",

Expand Down

0 comments on commit 7e6e53d

Please sign in to comment.