Socket
Socket
Sign inDemoInstall

@stdlib/utils-define-nonenumerable-read-only-property

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/utils-define-nonenumerable-read-only-property

Define a non-enumerable read-only property.


Version published
Weekly downloads
479K
decreased by-0.11%
Maintainers
4
Weekly downloads
 
Created

What is @stdlib/utils-define-nonenumerable-read-only-property?

@stdlib/utils-define-nonenumerable-read-only-property is a utility package that allows you to define non-enumerable, read-only properties on objects. This can be useful for creating properties that should not be iterated over in loops and should not be modified.

What are @stdlib/utils-define-nonenumerable-read-only-property's main functionalities?

Define Non-Enumerable Read-Only Property

This feature allows you to define a property on an object that is non-enumerable and read-only. The property will not show up in for-in loops and cannot be modified.

const defineNonEnumerableReadOnlyProperty = require('@stdlib/utils-define-nonenumerable-read-only-property');

const obj = {};
defineNonEnumerableReadOnlyProperty(obj, 'foo', 'bar');

console.log(obj.foo); // 'bar'

for (const key in obj) {
  console.log(key); // This will not log 'foo'
}

obj.foo = 'baz';
console.log(obj.foo); // 'bar' (value is not changed)

Other packages similar to @stdlib/utils-define-nonenumerable-read-only-property

Keywords

FAQs

Package last updated on 26 Jul 2024

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