Call includes directly on visited array

This commit is contained in:
Kevin Sawicki 2016-07-11 09:54:18 -07:00
parent 2cc2b8a146
commit 5da0b856f9

View file

@ -5,14 +5,12 @@ const {ipcRenderer, isPromise, CallbacksRegistry} = require('electron')
const callbacksRegistry = new CallbacksRegistry()
var includes = [].includes
var remoteObjectCache = v8Util.createIDWeakMap()
// Check for circular reference.
var isCircular = function (field, visited) {
if (typeof field === 'object') {
if (includes.call(visited, field)) {
if (visited.includes(field)) {
return true
}
visited.push(field)