@digitalasset/daml-ledger
Version:
DAML Ledger API Node.js bindings
22 lines • 907 B
JavaScript
;
// 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.integerString = void 0;
const Native_1 = require("./Native");
exports.integerString = {
type: 'integerString',
validate(value, key, validation) {
const node = key !== undefined && validation !== undefined ? Native_1.native('string').validate(value, key, validation) : Native_1.native('string').validate(value);
if (typeof value === "string") {
if (value.search(/^[-+]?[0-9]+$/) === -1) {
node.errors.push({
errorType: "invalid-integer-string",
actualValue: value
});
}
}
return validation || node;
}
};
//# sourceMappingURL=IntegerString.js.map