From: Ardis Lu Date: Sat, 22 Feb 2025 09:45:03 +0000 (-0800) Subject: Rollback null-prototype to object prototype X-Git-Tag: v0.1.0~41 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=d53bbd226bb1b954de9ac7d9faf132d090ceb2c8;p=csvio Rollback null-prototype to object prototype Name collision is unlikely and enumeration may be useful. And it is easier for JSDoc to parse normal object initialization than `Object.create`. --- diff --git a/src/errorStrategies.js b/src/errorStrategies.js index 00968ad..a136b41 100644 --- a/src/errorStrategies.js +++ b/src/errorStrategies.js @@ -11,9 +11,7 @@ import { setTimeout } from 'node:timers/promises'; async function sleep(ms) { await setTimeout(ms); } -export const utils = Object.create(null, { - sleep: { value: sleep, writable: true, enumerable: true, configurable: true } -}); +export const utils = { sleep }; /** * Create a `TransformationErrorFunction` that handles errors by filling the output row with a given placeholder value. @@ -90,9 +88,5 @@ function backoff(iterations, maxExponent, value) { } } -export const ErrorStrategies = Object.create(null, { - placeholder: { value: placeholder }, - retry: { value: retry }, - backoff: { value: backoff } -}); +export const ErrorStrategies = { placeholder, retry, backoff }; Object.freeze(ErrorStrategies); \ No newline at end of file