@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
35 lines • 1.27 kB
JavaScript
;
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultToZeroValue = defaultToZeroValue;
exports.startCountingDefaultToZeroValue = startCountingDefaultToZeroValue;
const unrecognized_js_1 = require("./unrecognized.js");
let globalCount = 0;
let refCount = 0;
function defaultToZeroValue(value) {
globalCount++;
return (0, unrecognized_js_1.unrecognized)(value);
}
function startCountingDefaultToZeroValue() {
refCount++;
const start = globalCount;
return {
/**
* Ends counting and returns the delta.
* @param delta - If provided, only this amount is added to the parent counter
* (used for nested unions where we only want to record the winning option's count).
* If not provided, records all counts since start().
*/
end: (delta) => {
const count = globalCount - start;
// Reset globalCount back to start, then add only the specified delta
globalCount = start + (delta ?? count);
if (--refCount === 0)
globalCount = 0;
return count;
},
};
}
//# sourceMappingURL=defaultToZeroValue.js.map