Skip to content

Commit cd4d50d

Browse files
author
Robin Frischmann
authored
Merge pull request #115 from lencioni/regex-test
Use regex.test(str) instead of str.match(regex)
2 parents 11ba89c + 837bf96 commit cd4d50d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

modules/dynamic/plugins/gradient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function gradient(
1313
): ?Array<any> | ?any {
1414
if (
1515
typeof value === 'string' &&
16-
value.match(values) !== null &&
16+
values.test(value) &&
1717
(browserName === 'firefox' && browserVersion < 16 ||
1818
browserName === 'chrome' && browserVersion < 26 ||
1919
(browserName === 'safari' || browserName === 'ios_saf') && browserVersion < 7 ||

modules/static/plugins/gradient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const prefixes = ['-webkit-', '-moz-', '']
55
const values = /linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/
66

77
export default function gradient(property: string, value: any): ?Array<string> {
8-
if (typeof value === 'string' && !isPrefixedValue(value) && value.match(values) !== null) {
8+
if (typeof value === 'string' && !isPrefixedValue(value) && values.test(value)) {
99
return prefixes.map(prefix => prefix + value)
1010
}
1111
}

modules/static/plugins/transition.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function transition(
6262
// if the property is already prefixed
6363
const webkitOutput = outputValue
6464
.split(/,(?![^()]*(?:\([^()]*\))?\))/g)
65-
.filter(val => val.match(/-moz-|-ms-/) === null)
65+
.filter(val => !/-moz-|-ms-/.test(val))
6666
.join(',')
6767

6868
if (property.indexOf('Webkit') > -1) {
@@ -71,7 +71,7 @@ export default function transition(
7171

7272
const mozOutput = outputValue
7373
.split(/,(?![^()]*(?:\([^()]*\))?\))/g)
74-
.filter(val => val.match(/-webkit-|-ms-/) === null)
74+
.filter(val => !/-webkit-|-ms-/.test(val))
7575
.join(',')
7676

7777
if (property.indexOf('Moz') > -1) {

0 commit comments

Comments
 (0)