UNPKG

terraform-generator

Version:

Generate Terraform configurations with Node.js.

49 lines (48 loc) 1.69 kB
"use strict"; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _a, _Function_constructArgument; Object.defineProperty(exports, "__esModule", { value: true }); exports.fn = exports.Function = void 0; const utils_1 = require("../utils"); const _1 = require("."); /** * @category Argument */ class Function extends _1.Argument { /** * Construct function argument. * * @param name function name * @param args function arguments */ constructor(name, ...args) { super(__classPrivateFieldGet(_a, _a, "m", _Function_constructArgument).call(_a, name, ...args)); } } exports.Function = Function; _a = Function, _Function_constructArgument = function _Function_constructArgument(fn, ...args) { let str = `${fn}(`; args.forEach((arg, i) => { str += utils_1.Util.argumentValueToString(arg); if (i < args.length - 1) { str += ', '; } }); str += ')'; return str; }; /** * Convenient function to construct new [[Function]]. * * @param name function name * @param args function arguments * * @category Argument */ // eslint-disable-next-line @typescript-eslint/ban-types const fn = (name, ...args) => new Function(name, ...args); exports.fn = fn;