UNPKG

@joshfarrant/shortcuts-js

Version:
18 lines 776 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** @ignore */ exports.withVariables = (strings, ...vars) => ({ WFSerializationType: 'WFTextTokenString', Value: { string: strings.join('\ufffc'), attachmentsByRange: strings.reduce((a, _, i, s) => { // If we've got no vars for this string, skip if (!vars[i]) return a; // Calculate the length of the string so far, including the replacement character const lengthSoFar = s.reduce((a2, c2, i2) => ((i2 <= i) ? (a2 + c2.length + 1) : a2), -1); return Object.assign(Object.assign({}, a), { [`{${lengthSoFar}, 1}`]: vars[i].Value }); }, {}), }, }); //# sourceMappingURL=withVariables.js.map