Skip to content

Commit

Permalink
fix: use Array.from
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie committed Feb 10, 2019
1 parent 3cfbf87 commit f9604c0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/client/updaters/tag.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// borrow the slice method
const toArray = Function.prototype.call.bind(Array.prototype.slice)

/**
* Updates meta tags inside <head> and <body> on the client. Borrowed from `react-helmet`:
* https://github.com/nfl/react-helmet/blob/004d448f8de5f823d10f838b02317521180f34da/src/Helmet.js#L195-L245
Expand All @@ -10,8 +7,8 @@ const toArray = Function.prototype.call.bind(Array.prototype.slice)
* @return {Object} - a representation of what tags changed
*/
export default function updateTag({ attribute, tagIDKeyName } = {}, type, tags, headTag, bodyTag) {
const oldHeadTags = toArray(headTag.querySelectorAll(`${type}[${attribute}]`))
const oldBodyTags = toArray(bodyTag.querySelectorAll(`${type}[${attribute}][data-body="true"]`))
const oldHeadTags = Array.from(headTag.querySelectorAll(`${type}[${attribute}]`))
const oldBodyTags = Array.from(bodyTag.querySelectorAll(`${type}[${attribute}][data-body="true"]`))
const newTags = []

if (tags.length > 1) {
Expand Down

0 comments on commit f9604c0

Please sign in to comment.