UNPKG

to-pairs

Version:

Convert an object into an array.

21 lines (15 loc) 520 B
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.toPairs = factory()); })(this, (function () { 'use strict'; var toPairs = (obj) => { const keys = Object.keys(obj); const pairs = []; for (const key of keys) { pairs.push([key, obj[key]]); } return pairs; }; return toPairs; }));