source: node_modules/es-toolkit/dist/compat/object/toPairsIn.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 795 bytes
Line 
1'use strict';
2
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5const keysIn = require('./keysIn.js');
6const mapToEntries = require('../_internal/mapToEntries.js');
7const setToEntries = require('../_internal/setToEntries.js');
8
9function toPairsIn(object) {
10 if (object == null) {
11 return [];
12 }
13 if (object instanceof Set) {
14 return setToEntries.setToEntries(object);
15 }
16 if (object instanceof Map) {
17 return mapToEntries.mapToEntries(object);
18 }
19 const keys = keysIn.keysIn(object);
20 const result = new Array(keys.length);
21 for (let i = 0; i < keys.length; i++) {
22 const key = keys[i];
23 const value = object[key];
24 result[i] = [key, value];
25 }
26 return result;
27}
28
29exports.toPairsIn = toPairsIn;
Note: See TracBrowser for help on using the repository browser.