mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 00:32:56 +03:00
chore: minor code refactoring (#170)
* refactor: use includes to check for existence * fix: negate
This commit is contained in:
1 parent
b15a15466e
commit
a06d9a68bc
1 file changed
+2
-2
Vendored
+2
-2
@@ -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");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user