UNPKG

multi-data

Version:
3 lines (2 loc) 1.06 kB
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).multiData=t()}(this,function(){"use strict";return function(){function n(t){if(function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.lines=[],void 0===t)throw new TypeError("boundary expected");this.boundary=t}var t=n.prototype;return t.append=function(n,t,e){if(void 0===n)throw new TypeError("name expected");if(void 0===t)throw new TypeError("data expected");if(this.lines.push("--".concat(this.boundary)),this.lines.push('Content-Disposition: form-data; name="'.concat(n,'"')),e&&e.headers){var i=e.headers;for(var o in i)this.lines.push("".concat(o,": ").concat(i[o]))}return this.lines.push(""),this.lines.push(t.toString()),this},t.toString=function(){this.lines.push("--".concat(this.boundary,"--"));var n=this.lines.join("\r\n");return this.lines.pop(),n},n}()}); //# sourceMappingURL=multi-data.min.cjs.map