diff options
author | RaindropsSys <contact@minteck.org> | 2023-04-06 22:18:28 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-04-06 22:18:28 +0200 |
commit | 83354b2b88218090988dd6e526b0a2505b57e0f1 (patch) | |
tree | e3c73c38a122a78bb7e66fbb99056407edd9d4b9 /includes/external/addressbook/node_modules/form-data-encoder/lib/util | |
parent | 47b8f2299a483024c4a6a8876af825a010954caa (diff) | |
download | pluralconnect-83354b2b88218090988dd6e526b0a2505b57e0f1.tar.gz pluralconnect-83354b2b88218090988dd6e526b0a2505b57e0f1.tar.bz2 pluralconnect-83354b2b88218090988dd6e526b0a2505b57e0f1.zip |
Updated 5 files and added 1110 files (automated)
Diffstat (limited to 'includes/external/addressbook/node_modules/form-data-encoder/lib/util')
10 files changed, 86 insertions, 0 deletions
diff --git a/includes/external/addressbook/node_modules/form-data-encoder/lib/util/Headers.js b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/Headers.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/Headers.js @@ -0,0 +1 @@ +export {}; diff --git a/includes/external/addressbook/node_modules/form-data-encoder/lib/util/createBoundary.js b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/createBoundary.js new file mode 100644 index 0000000..4ed7434 --- /dev/null +++ b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/createBoundary.js @@ -0,0 +1,9 @@ +const alphabet = "abcdefghijklmnopqrstuvwxyz0123456789"; +export function createBoundary() { + let size = 16; + let res = ""; + while (size--) { + res += alphabet[(Math.random() * alphabet.length) << 0]; + } + return res; +} diff --git a/includes/external/addressbook/node_modules/form-data-encoder/lib/util/escapeName.js b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/escapeName.js new file mode 100644 index 0000000..8b2ce25 --- /dev/null +++ b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/escapeName.js @@ -0,0 +1,4 @@ +export const escapeName = (name) => String(name) + .replace(/\r/g, "%0D") + .replace(/\n/g, "%0A") + .replace(/"/g, "%22"); diff --git a/includes/external/addressbook/node_modules/form-data-encoder/lib/util/getStreamIterator.js b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/getStreamIterator.js new file mode 100644 index 0000000..f97676a --- /dev/null +++ b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/getStreamIterator.js @@ -0,0 +1,21 @@ +import { isFunction } from "./isFunction.js"; +const isAsyncIterable = (value) => (isFunction(value[Symbol.asyncIterator])); +async function* readStream(readable) { + const reader = readable.getReader(); + while (true) { + const { done, value } = await reader.read(); + if (done) { + break; + } + yield value; + } +} +export const getStreamIterator = (source) => { + if (isAsyncIterable(source)) { + return source; + } + if (isFunction(source.getReader)) { + return readStream(source); + } + throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable."); +}; diff --git a/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isFile.js b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isFile.js new file mode 100644 index 0000000..eec965d --- /dev/null +++ b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isFile.js @@ -0,0 +1,8 @@ +import { isFunction } from "./isFunction.js"; +export const isFile = (value) => Boolean(value + && typeof value === "object" + && isFunction(value.constructor) + && value[Symbol.toStringTag] === "File" + && isFunction(value.stream) + && value.name != null); +export const isFileLike = isFile; diff --git a/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isFormData.js b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isFormData.js new file mode 100644 index 0000000..237419f --- /dev/null +++ b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isFormData.js @@ -0,0 +1,8 @@ +import { isFunction } from "./isFunction.js"; +export const isFormData = (value) => Boolean(value + && isFunction(value.constructor) + && value[Symbol.toStringTag] === "FormData" + && isFunction(value.append) + && isFunction(value.getAll) + && isFunction(value.entries) + && isFunction(value[Symbol.iterator])); diff --git a/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isFunction.js b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isFunction.js new file mode 100644 index 0000000..a8dbdc2 --- /dev/null +++ b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isFunction.js @@ -0,0 +1 @@ +export const isFunction = (value) => (typeof value === "function"); diff --git a/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isPlainObject.js b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isPlainObject.js new file mode 100644 index 0000000..9f3fb7e --- /dev/null +++ b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/isPlainObject.js @@ -0,0 +1,12 @@ +const getType = (value) => (Object.prototype.toString.call(value).slice(8, -1).toLowerCase()); +export function isPlainObject(value) { + if (getType(value) !== "object") { + return false; + } + const pp = Object.getPrototypeOf(value); + if (pp === null || pp === undefined) { + return true; + } + const Ctor = pp.constructor && pp.constructor.toString(); + return Ctor === Object.toString(); +} diff --git a/includes/external/addressbook/node_modules/form-data-encoder/lib/util/normalizeValue.js b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/normalizeValue.js new file mode 100644 index 0000000..05e058a --- /dev/null +++ b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/normalizeValue.js @@ -0,0 +1,8 @@ +export const normalizeValue = (value) => String(value) + .replace(/\r|\n/g, (match, i, str) => { + if ((match === "\r" && str[i + 1] !== "\n") + || (match === "\n" && str[i - 1] !== "\r")) { + return "\r\n"; + } + return match; +}); diff --git a/includes/external/addressbook/node_modules/form-data-encoder/lib/util/proxyHeaders.js b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/proxyHeaders.js new file mode 100644 index 0000000..05a4ab3 --- /dev/null +++ b/includes/external/addressbook/node_modules/form-data-encoder/lib/util/proxyHeaders.js @@ -0,0 +1,14 @@ +function getProperty(target, prop) { + if (typeof prop === "string") { + for (const [name, value] of Object.entries(target)) { + if (prop.toLowerCase() === name.toLowerCase()) { + return value; + } + } + } + return undefined; +} +export const proxyHeaders = (object) => new Proxy(object, { + get: (target, prop) => getProperty(target, prop), + has: (target, prop) => getProperty(target, prop) !== undefined +}); |