From 2833db78ad26c0920597f2a317bd258843c4dbaf Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 15 Jan 2016 09:30:29 -0800 Subject: [PATCH] Use [].inclues where appropriate --- atom/browser/api/lib/dialog.js | 3 ++- atom/renderer/api/lib/desktop-capturer.js | 6 +++--- atom/renderer/api/lib/remote.js | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/atom/browser/api/lib/dialog.js b/atom/browser/api/lib/dialog.js index 94d78634b532..5c3cdeed3044 100644 --- a/atom/browser/api/lib/dialog.js +++ b/atom/browser/api/lib/dialog.js @@ -4,6 +4,7 @@ const binding = process.atomBinding('dialog'); const v8Util = process.atomBinding('v8_util'); var slice = [].slice; +var includes = [].includes; var indexOf = [].indexOf; var fileDialogProperties = { @@ -61,7 +62,7 @@ module.exports = { properties = 0; for (prop in fileDialogProperties) { value = fileDialogProperties[prop]; - if (indexOf.call(options.properties, prop) >= 0) { + if (includes.call(options.properties, prop)) { properties |= value; } } diff --git a/atom/renderer/api/lib/desktop-capturer.js b/atom/renderer/api/lib/desktop-capturer.js index 921ede582544..8912deea3a8f 100644 --- a/atom/renderer/api/lib/desktop-capturer.js +++ b/atom/renderer/api/lib/desktop-capturer.js @@ -2,7 +2,7 @@ const ipcRenderer = require('electron').ipcRenderer; const nativeImage = require('electron').nativeImage; var nextId = 0; -var indexOf = [].indexOf; +var includes = [].includes; var getNextId = function() { return ++nextId; @@ -18,8 +18,8 @@ exports.getSources = function(options, callback) { if (!isValid(options)) { return callback(new Error('Invalid options')); } - captureWindow = indexOf.call(options.types, 'window') >= 0; - captureScreen = indexOf.call(options.types, 'screen') >= 0; + captureWindow = includes.call(options.types, 'window'); + captureScreen = includes.call(options.types, 'screen'); if (options.thumbnailSize == null) { options.thumbnailSize = { width: 150, diff --git a/atom/renderer/api/lib/remote.js b/atom/renderer/api/lib/remote.js index a91a71556dd7..c43b52c2e82f 100644 --- a/atom/renderer/api/lib/remote.js +++ b/atom/renderer/api/lib/remote.js @@ -4,12 +4,12 @@ const v8Util = process.atomBinding('v8_util'); const callbacksRegistry = new CallbacksRegistry; -var indexOf = [].indexOf; +var includes = [].includes; // Check for circular reference. var isCircular = function(field, visited) { if (typeof field === 'object') { - if (indexOf.call(visited, field) >= 0) { + if (includes.call(visited, field)) { return true; } visited.push(field);