If an iterable's @@iterator method does not return an iterator object, then it is a non-well-formed iterable.
Just like this:
import arrify from "arrify";
let iterable = {
0: "a",
1: "b",
2: "c",
length: 3,
[Symbol.iterator]: () => 1,
};
console.log(arrify(iterable));
You will get an error:
file:///D:/05-personal/node/nodejs-debugging/node_modules/arrify/index.js:15
return [...value];
^
TypeError: Result of the Symbol.iterator method is not an object
at arrify (file:///D:/05-personal/node/nodejs-debugging/node_modules/arrify/index.js:15:14)
at file:///D:/05-personal/node/nodejs-debugging/src/index.js:50:13
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
error Command failed with exit code 1.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too