Use [].inclues where appropriate
This commit is contained in:
parent
c2d473cf65
commit
2833db78ad
3 changed files with 7 additions and 6 deletions
|
@ -4,6 +4,7 @@ const binding = process.atomBinding('dialog');
|
||||||
const v8Util = process.atomBinding('v8_util');
|
const v8Util = process.atomBinding('v8_util');
|
||||||
|
|
||||||
var slice = [].slice;
|
var slice = [].slice;
|
||||||
|
var includes = [].includes;
|
||||||
var indexOf = [].indexOf;
|
var indexOf = [].indexOf;
|
||||||
|
|
||||||
var fileDialogProperties = {
|
var fileDialogProperties = {
|
||||||
|
@ -61,7 +62,7 @@ module.exports = {
|
||||||
properties = 0;
|
properties = 0;
|
||||||
for (prop in fileDialogProperties) {
|
for (prop in fileDialogProperties) {
|
||||||
value = fileDialogProperties[prop];
|
value = fileDialogProperties[prop];
|
||||||
if (indexOf.call(options.properties, prop) >= 0) {
|
if (includes.call(options.properties, prop)) {
|
||||||
properties |= value;
|
properties |= value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ const ipcRenderer = require('electron').ipcRenderer;
|
||||||
const nativeImage = require('electron').nativeImage;
|
const nativeImage = require('electron').nativeImage;
|
||||||
|
|
||||||
var nextId = 0;
|
var nextId = 0;
|
||||||
var indexOf = [].indexOf;
|
var includes = [].includes;
|
||||||
|
|
||||||
var getNextId = function() {
|
var getNextId = function() {
|
||||||
return ++nextId;
|
return ++nextId;
|
||||||
|
@ -18,8 +18,8 @@ exports.getSources = function(options, callback) {
|
||||||
if (!isValid(options)) {
|
if (!isValid(options)) {
|
||||||
return callback(new Error('Invalid options'));
|
return callback(new Error('Invalid options'));
|
||||||
}
|
}
|
||||||
captureWindow = indexOf.call(options.types, 'window') >= 0;
|
captureWindow = includes.call(options.types, 'window');
|
||||||
captureScreen = indexOf.call(options.types, 'screen') >= 0;
|
captureScreen = includes.call(options.types, 'screen');
|
||||||
if (options.thumbnailSize == null) {
|
if (options.thumbnailSize == null) {
|
||||||
options.thumbnailSize = {
|
options.thumbnailSize = {
|
||||||
width: 150,
|
width: 150,
|
||||||
|
|
|
@ -4,12 +4,12 @@ const v8Util = process.atomBinding('v8_util');
|
||||||
|
|
||||||
const callbacksRegistry = new CallbacksRegistry;
|
const callbacksRegistry = new CallbacksRegistry;
|
||||||
|
|
||||||
var indexOf = [].indexOf;
|
var includes = [].includes;
|
||||||
|
|
||||||
// Check for circular reference.
|
// Check for circular reference.
|
||||||
var isCircular = function(field, visited) {
|
var isCircular = function(field, visited) {
|
||||||
if (typeof field === 'object') {
|
if (typeof field === 'object') {
|
||||||
if (indexOf.call(visited, field) >= 0) {
|
if (includes.call(visited, field)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
visited.push(field);
|
visited.push(field);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue