Like Object.entries, but using getOwnPropertyNames, so that key order is respected
npm install ordered-entriesA follyfill (lol) for Object.entries.
Like Object.keys, Object.entries is not required to reflect property order (which is a real thing since ES2015).
For a good summary, see this answer to Does ES6 introduce a well-defined order of enumeration for object properties?
This implementation uses Object.getOwnPropertyNames, which is required to respect property order.
``sh`
npm i ordered-entries -S
`js``
orderedEntries({ a: 'yup', b: 'yarp' }) // => [ [ 'a', 'yup' ], [ 'b', 'yarp' ] ]