array-envelop
This wraps an array-like object to an array so that every array method can be utilized. Try yourself via RunKit.
; const object = 0: "maya" 1: "eve" length: 2; const enveloped = ;enveloped; // returns 1 /* * Anything that mutates the array will throw, including the followings: * * enveloped.length = "peanut"; * enveloped.push("peanut"); * enveloped.pop(); * enveloped.shift(); */
Array.from
?
Why not Array.from
copies everything while array-envelop
keeps refering to the original object.
object2 = "aya";objectlength = 3; enveloped; // "maya eve aya"
const liveNodeList = document; ; // a live array that changes as the document structure does