@hestia-earth/utils
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -0,1 +1,7 @@ | ||
declare class Term { | ||
'@id': string; | ||
name: string; | ||
} | ||
export declare const validateTerms: (terms: Term[]) => Promise<(string | true)[]>; | ||
export declare const run: () => Promise<string[]>; | ||
export {}; |
@@ -55,3 +55,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.run = void 0; | ||
exports.run = exports.validateTerms = void 0; | ||
var fs_1 = require("fs"); | ||
@@ -123,3 +123,3 @@ var path_1 = require("path"); | ||
}; | ||
var queryTerms = function (terms) { return __awaiter(void 0, void 0, void 0, function () { | ||
var validateTerms = function (terms) { return __awaiter(void 0, void 0, void 0, function () { | ||
var query, results; | ||
@@ -156,2 +156,3 @@ return __generator(this, function (_a) { | ||
}); }; | ||
exports.validateTerms = validateTerms; | ||
var validateFile = function (_a) { | ||
@@ -165,3 +166,3 @@ var filepath = _a.filepath, data = _a.data; | ||
terms = array_1.unique(getAllTerms(data)); | ||
return [4, queryTerms(terms)]; | ||
return [4, exports.validateTerms(terms)]; | ||
case 1: | ||
@@ -168,0 +169,0 @@ missing = _b.sent(); |
{ | ||
"name": "@hestia-earth/utils", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "Hestia Utils library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -54,3 +54,9 @@ import { promises } from 'fs'; | ||
const queryTerms = async (terms: Term[]) => { | ||
/** | ||
* Validate a list of Terms. | ||
* | ||
* @param terms The list of Terms to validate. | ||
* @returns The list of ids/names that could not be found (invalid). | ||
*/ | ||
export const validateTerms = async (terms: Term[]) => { | ||
const query = { | ||
@@ -78,3 +84,3 @@ bool: { | ||
const terms = unique(getAllTerms(data)); | ||
const missing = await queryTerms(terms); | ||
const missing = await validateTerms(terms); | ||
return { | ||
@@ -81,0 +87,0 @@ filepath, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43467
748