]> git.ardis.lu - csvio/commitdiff
Rollback null-prototype to object prototype
authorArdis Lu <ardisglu@gmail.com>
Sat, 22 Feb 2025 09:45:03 +0000 (01:45 -0800)
committerArdis Lu <ardisglu@gmail.com>
Sat, 22 Feb 2025 09:45:03 +0000 (01:45 -0800)
Name collision is unlikely and enumeration may be useful. And it is easier for JSDoc to parse normal object initialization than `Object.create`.

src/errorStrategies.js

index 00968adfc260f146622ba6975999f8cae62f6f38..a136b41deb271d423d4cfb8c20f38f6faba66689 100644 (file)
@@ -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
This page took 0.04156 seconds and 4 git commands to generate.