Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fromentries

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fromentries

Object.fromEntries() ponyfill (in 6 lines)

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.7M
increased by3.83%
Maintainers
1
Weekly downloads
 
Created

What is fromentries?

The 'fromentries' npm package provides a polyfill for the Object.fromEntries method, which transforms a list of key-value pairs into an object. This is particularly useful for converting Map objects or arrays of pairs into plain JavaScript objects.

What are fromentries's main functionalities?

Convert Array of Pairs to Object

This feature allows you to convert an array of key-value pairs into a plain JavaScript object. This is useful for scenarios where data is received in a pair format and needs to be transformed into an object.

const fromEntries = require('fromentries');
const entries = [['name', 'Alice'], ['age', 30]];
const obj = fromEntries(entries);
console.log(obj); // { name: 'Alice', age: 30 }

Convert Map to Object

This feature allows you to convert a Map object into a plain JavaScript object. This is useful for scenarios where data is stored in a Map and needs to be transformed into an object for easier manipulation.

const fromEntries = require('fromentries');
const map = new Map([['name', 'Bob'], ['age', 25]]);
const obj = fromEntries(map);
console.log(obj); // { name: 'Bob', age: 25 }

Other packages similar to fromentries

Keywords

FAQs

Package last updated on 04 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc