Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
This commit is contained in:
Adam R 2020-11-05 23:51:08 +01:00 committed by GitHub
parent 5b69bc5af4
commit 2ff883945e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,13 +9,13 @@ import {
isPathExistsSync
} from "./filesystem";
import { arrayDiff } from "./types";
import { isValidJSON, writeJsonFile } from "../generic/json";
import { isValidJSON } from "../generic/json";
import { ActionInterface, CheckStepInterface } from "../generic/interface";
import * as bluebird from "bluebird";
const requiredKeys = ["explorer", "name", "website", "short_description"];
function isAssetInfoHasAllKeys(info: any, path: string): [boolean, string] {
function isAssetInfoHasAllKeys(info: unknown, path: string): [boolean, string] {
const infoKeys = Object.keys(info);
const hasAllKeys = requiredKeys.every(k => Object.prototype.hasOwnProperty.call(info, k));
@ -25,10 +25,10 @@ function isAssetInfoHasAllKeys(info: any, path: string): [boolean, string] {
}
const isKeysCorrentType =
typeof info.explorer === "string" && info.explorer != ""
&& typeof info.name === "string" && info.name != ""
&& typeof info.website === "string"
&& typeof info.short_description === "string";
typeof info['explorer'] === "string" && info['explorer'] != ""
&& typeof info['name'] === "string" && info['name'] != ""
&& typeof info['website'] === "string"
&& typeof info['short_description'] === "string";
return [isKeysCorrentType, `Check keys '${requiredKeys}' vs. '${infoKeys}'`];
}