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

predefine

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

predefine

Predefine your Object.defineProperties to create a more human readable API.

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
decreased by-4.91%
Maintainers
1
Weekly downloads
 
Created
Source

predefine

Build Status

When creating objects or prototypes using Object.defineProperties or Object.defineProperty it make your code look really verbose by all the property descriptions that it needs. Most of the time, they are the same. They either make your properties writable, readable or prevents them from being enumerable. So basically:

Predefine makes Object.defineProperties your human readable and manageable.

Installation

npm install --save predefine

Getting started

var predefine = require('predefine');

function Base() {
  var readable = predefine(this, { configurable: false, enumerable: false })
    , writable = predefine(this, predefine.WRITABLE);

  readable('prop', 'value');
  writable('data', []);
}

Base.writable = predefine(Base.prototype, predefine.WRITABLE);

Base.writable('foo', 'bar');

License

MIT

Keywords

FAQs

Package last updated on 04 Jan 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

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