From 1174999864fa9820297d9c4306206fcca1717e59 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 31 Jul 2022 23:02:03 -0400 Subject: [PATCH] *Add missing files --- dist/util.d.ts | 2 ++ dist/util.d.ts.map | 1 + dist/util.js | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 dist/util.d.ts create mode 100644 dist/util.d.ts.map create mode 100644 dist/util.js diff --git a/dist/util.d.ts b/dist/util.d.ts new file mode 100644 index 0000000..79a76b8 --- /dev/null +++ b/dist/util.d.ts @@ -0,0 +1,2 @@ +export declare function flatten(target: any, opts?: any): any[]; +//# sourceMappingURL=util.d.ts.map \ No newline at end of file diff --git a/dist/util.d.ts.map b/dist/util.d.ts.map new file mode 100644 index 0000000..876e5eb --- /dev/null +++ b/dist/util.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAWA,wBAAgB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,GAAE,GAAQ,GAAG,GAAG,EAAE,CAuC1D"} \ No newline at end of file diff --git a/dist/util.js b/dist/util.js new file mode 100644 index 0000000..91bc79e --- /dev/null +++ b/dist/util.js @@ -0,0 +1,39 @@ +function isBuffer(obj) { + return (obj && + obj.constructor && + typeof obj.constructor.isBuffer === "function" && + obj.constructor.isBuffer(obj)); +} +/* +Forked from https://github.com/hughsk/flat + */ +export function flatten(target, opts = {}) { + opts = opts || {}; + const delimiter = opts.delimiter || "."; + const maxDepth = opts.maxDepth; + const transformKey = opts.transformKey || ((key) => (isNaN(parseInt(key)) ? key : "")); + const output = []; + function step(object, prev, currentDepth) { + currentDepth = currentDepth || 1; + Object.keys(object).forEach(function (key) { + const value = object[key]; + const isarray = opts.safe && Array.isArray(value); + const type = Object.prototype.toString.call(value); + const isbuffer = isBuffer(value); + const isobject = type === "[object Object]" || type === "[object Array]"; + const newKey = prev + ? prev + delimiter + transformKey(key) + : transformKey(key); + if (!isarray && + !isbuffer && + isobject && + Object.keys(value).length && + (!opts.maxDepth || currentDepth < maxDepth)) { + return step(value, newKey, currentDepth + 1); + } + output.push(`${newKey}=${value}`); + }); + } + step(target); + return output; +}