From a06d9a68bcb7a0ce6531f2a105bb8b7cd5063355 Mon Sep 17 00:00:00 2001 From: James George Date: Wed, 8 Jan 2020 22:19:56 +0530 Subject: [PATCH] chore: minor code refactoring (#170) * refactor: use includes to check for existence * fix: negate --- assets/vendor/json-to-jsdoc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/vendor/json-to-jsdoc.js b/assets/vendor/json-to-jsdoc.js index 453dc50..9e41dd5 100644 --- a/assets/vendor/json-to-jsdoc.js +++ b/assets/vendor/json-to-jsdoc.js @@ -5,7 +5,7 @@ function checkIfNeededToAddUndefinedType(obj, objectKey) { Object.keys(obj).forEach(currentKey => { // check if it's our Object, // like awards.editions in awards.editions.outcome - if (~currentKey.indexOf(objectKey) && currentKey !== objectKey) { + if (currentKey.includes(objectKey) && currentKey !== objectKey) { temporaryObject[currentKey] = obj[currentKey]; } }); @@ -35,7 +35,7 @@ function keepUniqueTypes(obj, jsonObjects) { const numberOfJSONDefinitions = jsonObjects.length; Object.keys(obj).forEach(objectKey => { - if (!~objectKey.indexOf(".")) { + if (!objectKey.includes(".")) { if (obj[objectKey].length < numberOfJSONDefinitions) { temporaryObject[objectKey].push("undefined"); }