🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prr

A better Object.defineProperty()

1.0.1
latest
Version published
Weekly downloads
9.7M
-20.54%
Maintainers
1
Weekly downloads
 
Created

What is prr?

The npm package 'prr' provides a simple and effective way to set properties on objects with specific property attributes in JavaScript. It is particularly useful for managing property descriptors with ease, allowing developers to control enumerable, writable, and configurable attributes.

What are prr's main functionalities?

Setting properties with custom attributes

This feature allows the setting of properties on an object while defining their attributes such as enumerable, writable, and configurable. The example shows how to set a non-enumerable property, which will not show up in Object.keys() but is still accessible on the object.

const prr = require('prr');

let obj = {};
// Setting a non-enumerable property
prr(obj, 'secret', 'hidden value', 'e');

console.log(Object.keys(obj)); // Will not show 'secret'
console.log(obj.secret); // Outputs 'hidden value'

Other packages similar to prr

FAQs

Package last updated on 22 Jul 2014

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