node-poppler 8.0.0 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +10 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-poppler",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "description": "Asynchronous Node.js wrapper for the Poppler PDF rendering library",
5
5
  "keywords": [
6
6
  "async",
package/src/index.js CHANGED
@@ -50,12 +50,17 @@ function parseOptions(acceptedOptions, options, version) {
50
50
  const args = [];
51
51
  /** @type {string[]} */
52
52
  const invalidArgs = [];
53
- const keys = Object.keys(options);
54
- const keysLength = keys.length;
55
- for (let i = 0; i < keysLength; i += 1) {
56
- const key = keys[i];
53
+ /**
54
+ * Imperative loops are faster than functional loops.
55
+ * @see {@link https://romgrk.com/posts/optimizing-javascript#3-avoid-arrayobject-methods || Optimizing JavaScript}
56
+ */
57
+ const entries = Object.entries(options);
58
+ const entriesLength = entries.length;
59
+ for (let i = 0; i < entriesLength; i += 1) {
60
+ // Destructuring adds overhead, so use index access
61
+ const key = entries[i][0];
57
62
  if (Object.hasOwn(acceptedOptions, key)) {
58
- const option = options[key];
63
+ const option = entries[i][1];
59
64
  const acceptedOption = acceptedOptions[key];
60
65
 
61
66
  // eslint-disable-next-line valid-typeof -- `type` is a string