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

object-deep-from-entries

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-deep-from-entries

Make an object or collection from entries deeply.

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

object-deep-from-entries

Make an object or collection from entries deeply.

devDependencies Status Build Status Code Coverage

Installation

You can install this package from Yarn:

yarn add object-deep-from-entries

Or NPM:

# Since ~5.x version you can omit the --save flag
npm install object-deep-from-entries

API

objectDeepFromEntries(entries) -> {object | object[] | any[]}

  • {Array<[string | number | Array<string | number>, any]>} – An array of tuples with paths and values. Path might be a string, number or an array of those to types. Value may have any type.

Usage

import objectDeepFromEntries from "object-deep-from-entries"

// You can create a flat object using entries in the same format
const flat = [
  [
    "name", "John Doe"
  ],
  [
    "age", 25
  ],
  [
    "gender", "Male"
  ]
]

objectDeepFromEntries(flat)
// -> {name: "John Doe", age: 25, gender: "Male"}

// This function is also useful for making "deep" objects. Let's take a look:
const deep = [
  [
    "name", "John Doe"
  ],
  [
    ["skills", 0], "Node.js"
  ],
  [
    ["skills", 1], "JavaScript"
  ],
  [
    ["skills", 2], "Preact"
  ]
]

objectDeepFromEntries(deep)
// -> {name: "John Doe", skills: [Node.js, "JavaScript", "Preact"]}

Keywords

FAQs

Package last updated on 13 Aug 2021

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