@harmoniclabs/plu-ts-onchain
Version:
An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript
23 lines (22 loc) • 984 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.addApplications = void 0;
var obj_utils_1 = require("@harmoniclabs/obj-utils");
var utils_1 = require("../../type_system/utils.js");
var papp_1 = require("../papp.js");
function addApplications(lambdaTerm) {
var nMissingArgs = (0, utils_1.getNRequiredLambdaArgs)(lambdaTerm.type);
if (nMissingArgs <= 1) {
return (0, obj_utils_1.defineReadOnlyProperty)(lambdaTerm, "$", function (input) {
var output = (0, papp_1.papp)(lambdaTerm, input);
return output;
});
}
return (0, obj_utils_1.defineReadOnlyProperty)(lambdaTerm, "$", function (input) {
// @ts-ignore
// Type 'PType[]' is not assignable to type '[PType, ...PType[]]'.
// Source provides no match for required element at position 0 in target
return addApplications((0, papp_1.papp)(lambdaTerm, input));
});
}
exports.addApplications = addApplications;