Skip to content

Commit

Permalink
Use RegExp#test instead of String#match
Browse files Browse the repository at this point in the history
Using `.test()` is both faster and more explicit.
  • Loading branch information
maranomynet committed Feb 18, 2016
1 parent dca271f commit 7a184cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mithril.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@
nodes = injectHTML(parentElement, index, data)
} else {
nodes = [$document.createTextNode(data)]
if (!parentElement.nodeName.match(voidElements)) {
if (!voidElements.test(parentElement.nodeName)) {
insertNode(parentElement, nodes[0], index)
}
}
Expand Down Expand Up @@ -1902,7 +1902,7 @@

m.deferred.onerror = function (e) {
if (type.call(e) === "[object Error]" &&
!e.constructor.toString().match(/ Error/)) {
!/ Error/.test(e.constructor.toString())) {
pendingRequests = 0
throw e
}
Expand Down

0 comments on commit 7a184cb

Please sign in to comment.