UNPKG

@digitalasset/daml-ledger

Version:
26 lines 896 B
"use strict"; // Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. // SPDX-License-Identifier: Apache-2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.native = void 0; const Validation_1 = require("./Validation"); function native(type) { return { type: type, validate(value, key, validation) { const node = Validation_1.init(key, validation); const actualType = Validation_1.typeOf(value); if (actualType !== type) { const error = { errorType: 'type-error', expectedType: type, actualType: actualType }; node.errors.push(error); } return validation || node; } }; } exports.native = native; //# sourceMappingURL=Native.js.map