UNPKG

@digitalasset/daml-ledger

Version:
26 lines 923 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.string = void 0; const Validation_1 = require("./Validation"); function string(literal) { return { type: `literal<${literal}>`, validate(value, key, validation) { const node = Validation_1.init(key, validation); if (value !== literal) { const actualType = Validation_1.typeOf(value); const error = { errorType: 'type-error', expectedType: this.type, actualType: actualType }; node.errors.push(error); } return validation || node; } }; } exports.string = string; //# sourceMappingURL=String.js.map