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

reconstruct-descriptors

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

reconstruct-descriptors

Deeply reconstruct any object iterating over its property descriptors.

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
46
increased by48.39%
Maintainers
1
Weekly downloads
 
Created
Source

reconstruct-descriptors

Build Status

Deeply reconstruct any object iterating over its property descriptors.

Install

reconstruct-descriptors is published on NPM Registry, so you can install it using any node package manager.

npm install reconstruct-descriptors

# If you're using Yarn.
yarn add reconstruct-descriptors

Usage

This module exports a function that receives an object and a function to iterate over property descriptors.

import reconstruct from 'reconstruct-descriptors'

const immutable = (object) => reconstruct(object, (descriptor, property) => ({
  [property]: {
    ...descriptor,
    writable: false,
    configurable: false
  }
}))

const user = immutable({ name: 'Ryan' })

user.name = 'Bruno'
console.log(user.name) // 'Ryan'

delete user.name
console.log(user.name) // 'Ryan'

License

Released under MIT license. You can see it here.

Keywords

FAQs

Package last updated on 09 Aug 2018

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