npm package diff

Package: @forge/cli

Versions: 12.8.0-next.18-experimental-003d118 - 12.8.0-next.24

File: package/out/custom-scopes/validation/index.js

Index: package/out/custom-scopes/validation/index.js
===================================================================
--- package/out/custom-scopes/validation/index.js
+++ package/out/custom-scopes/validation/index.js
@@ -0,0 +1,23 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.validate = void 0;
+const tslib_1 = require("tslib");
+const ajv_1 = tslib_1.__importDefault(require("ajv"));
+const schema = tslib_1.__importStar(require("./schema.json"));
+function validate(value) {
+    const ajv = new ajv_1.default({ allErrors: true, verbose: true, strict: true });
+    const validator = ajv.compile(schema);
+    const isValid = validator(value);
+    if (isValid) {
+        return {
+            isValid: true,
+            data: value
+        };
+    }
+    return {
+        isValid: false,
+        errors: validator.errors ?? []
+    };
+}
+exports.validate = validate;
+//# sourceMappingURL=index.js.map
\ No newline at end of file