diff --git a/src/communication/buildUrl.ts b/src/communication/buildUrl.ts index 97f667f1..2191ee58 100644 --- a/src/communication/buildUrl.ts +++ b/src/communication/buildUrl.ts @@ -2,7 +2,6 @@ import { URLSearchParams } from 'url'; import { apply, runIf } from 'ruply'; -import getEntries from '../plumbing/getEntries'; import type Maybe from '../types/Maybe'; export type SearchParameters = Record; @@ -21,7 +20,7 @@ export type SearchParameters = Record; * `?object[key]=value`). */ export default function buildUrl(originAndPathname: string, searchParameters?: SearchParameters): string { - const searchEntries = (runIf(searchParameters, getEntries) ?? []) as [string, Maybe>][]; + const searchEntries = (runIf(searchParameters, Object.entries) ?? []) as [string, Maybe>][]; if (searchEntries.length == 0) { return originAndPathname; } @@ -32,7 +31,7 @@ export default function buildUrl(originAndPathname: string, searchParameters?: S continue; } if (typeof value == 'object' && !Array.isArray(value)) { - for (const [innerKey, innerValue] of getEntries(value)) { + for (const [innerKey, innerValue] of Object.entries(value)) { flattenedEntries[`${key}[${innerKey}]`] = String(innerValue); } } /* if (typeof value != 'object' || Array.isArray(value)) */ else { diff --git a/src/data/Helper.ts b/src/data/Helper.ts index d0af7ab8..f03736f1 100644 --- a/src/data/Helper.ts +++ b/src/data/Helper.ts @@ -2,7 +2,6 @@ import { inspect, type InspectOptionsStylized } from 'util'; import type TransformingNetworkClient from '../communication/TransformingNetworkClient'; import buildFromEntries from '../plumbing/buildFromEntries'; import capitalize from '../plumbing/capitalize'; -import getEntries from '../plumbing/getEntries'; import renege from '../plumbing/renege'; import type Callback from '../types/Callback'; import type Maybe from '../types/Maybe'; @@ -22,7 +21,7 @@ function convertToString(subject: Model, tag: string, depth: number, opt if (depth < 0) { return options.stylize(`[${parts.join(' ')}]`, 'special'); } - parts.push(inspect(buildFromEntries(getEntries(subject).filter(([key]) => stringRepresentationBlacklist.has(key) === false)), { ...options, depth: 1, sorted: true })); + parts.push(inspect(buildFromEntries(Object.entries(subject).filter(([key]) => stringRepresentationBlacklist.has(key) === false)), { ...options, depth: 1, sorted: true })); return parts.join(' '); } diff --git a/src/plumbing/getEntries.ts b/src/plumbing/getEntries.ts deleted file mode 100644 index 2583b1fb..00000000 --- a/src/plumbing/getEntries.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Returns an array of the passed object's own enumerable string-keyed property `[key, value]` pairs. - * - * If support for Node.js < 7.0.0 is ever dropped, this function can be removed in favour of `Object.entries`. - */ -export default ((): ((input: Record) => [string, T][]) => { - if (Object.entries != undefined) { - return Object.entries; - } - return function getEntries(input: Record) { - return Object.keys(input).map(key => [key, input[key]]); - }; -})();