Skip to content

Commit

Permalink
Use match-all instead of String#matchAll to support Node.js v10.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Demedes committed Oct 3, 2020
1 parent a9ca1eb commit ee7ca99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
'use strict';
const matchAll = require('match-all');

// Tailwind started using CSS variables for color opacity since v1.4.0,
// this helper adds a primitive support for these
const useVariables = object => {
Expand All @@ -24,9 +26,7 @@ const useVariables = object => {
const FONT_VARIANT_REGEX = /(oldstyle-nums|lining-nums|tabular-nums|proportional-nums)/g;

const addFontVariant = (style, classNames) => {
const matches = [...classNames.matchAll(FONT_VARIANT_REGEX)].map(
match => match[0]
);
const matches = matchAll(classNames, FONT_VARIANT_REGEX).toArray();

if (matches.length > 0) {
style.fontVariant = matches;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"dependencies": {
"css": "^2.2.4",
"css-to-react-native": "^3.0.0",
"match-all": "^1.2.6",
"meow": "^7.0.1",
"postcss": "^7.0.30"
},
Expand Down

0 comments on commit ee7ca99

Please sign in to comment.