Skip to content

patches property descriptors so you can configure "non-configurable" properties of objects

Notifications You must be signed in to change notification settings

btford/property-lolscriptors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

property lolscriptors Build Status

patches property descriptor functions so you can configure "non-configurable" properties of objects

Install

npm install property-lolscriptors

Use

var patchPropertyDescriptors = require('property-lolscriptors');
var redefine = patchPropertyDescriptors();

var x = {};

Object.defineProperty(x, 'y', {
  value: 5
});

// x.y => 5

// throws TypeError:
Object.defineProperty(x, 'y', {
  value: 10
});

// x.y => 5

// will not throw TypeError
redefine(x, 'y', {
  value: 10
});

// x.y => 10

By default, property lolscriptors will patch window.Object or global.Object (whichever exists). Optionally, you can pass the pass function an instance of Object to patch:

var patchPropertyDescriptors = require('property-lolscriptors');
var redefine = patchPropertyDescriptors(Object);

// ...

license

MIT

About

patches property descriptors so you can configure "non-configurable" properties of objects

Resources

Stars

Watchers

Forks

Packages