New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

from-pairs

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

from-pairs

Convert arrays into objects.

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-63.64%
Maintainers
1
Weekly downloads
 
Created
Source

from-pairs Build Status

Convert arrays into objects.

Pass either a single list of [key, value] pairs, or a list of keys, and a list of values. Passing by pairs is the reverse of pairs. If duplicate keys exist, the last value wins.

Inspired by _.object. 😄

Install

Install with npm

$ npm install from-pairs

Or unpkg

<script src="https://unpkg.com/from-pairs@1.0.2/umd/index.js" />

Check out the unit tests on CodePen.

Usage

const fromPairs = require('from-pairs');

fromPairs(['moe', 'larry', 'curly'], [30, 40, 50]);
//=> {moe: 30, larry: 40, curly: 50}

fromPairs([['moe', 30], ['larry', 40], ['curly', 50]]);
//=> {moe: 30, larry: 40, curly: 50}

Like us a lot? Help others know why you like us! Review this package on pkgreview.devReview us on pkgreview.dev

API

fromPairs(list)

list

Type: array
Default: none

The key-value pairs.

License

MIT

Keywords

FAQs

Package last updated on 25 Mar 2022

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