Skip to content

Commit

Permalink
fix: convert collection into an array
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jun 15, 2020
1 parent e7b9742 commit 771496c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions packages/hover-vanilla/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import MicrolinkHover from '@microlink/hover-react'
import styled from 'styled-components'

function getDOMSelector (selector) {
return typeof selector === 'string'
? document.querySelectorAll(selector)
: [].concat(selector).filter(Boolean)
return Array.prototype.slice.call(
typeof selector === 'string'
? document.querySelectorAll(selector)
: selector
)
}

function forEach (list, fn) {
Expand Down
8 changes: 5 additions & 3 deletions packages/vanilla/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ function parseObject (obj) {
}

function getDOMSelector (selector) {
return typeof selector === 'string'
? document.querySelectorAll(selector)
: [].concat(selector).filter(Boolean)
return Array.prototype.slice.call(
typeof selector === 'string'
? document.querySelectorAll(selector)
: selector
)
}

function forEach (list, fn) {
Expand Down

0 comments on commit 771496c

Please sign in to comment.