chore: minor code refactoring (#170)

* refactor: use includes to check for existence

* fix: negate
This commit is contained in:
James George authored and Ritesh Kumar committed 2020-01-08 22:19:56 +05:30
1 parent b15a15466e
commit a06d9a68bc
1 file changed
+2 -2
+2 -2
View File
@@ -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");
}