Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including protect with all npm packages installed. Try it out:

var protect = require("protect")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

protect v0.5.0

protect your object from being overridden


NPM version Linux Status Windows Status Dependency Status Coveralls

protect your object from being overridden


Install through NPM

npm install protect


git clone git://


inside nodejs project

var protect = require('protect');

var newObj = protect({
    foo: 'ciao'

newObj.ciao = 'ciao'; = 123;

with this exception = 123;
TypeError: Cannot assign to read only property 'foo' of [object Object]

protect(obj, [normal])


  • obj - Object Your object (default "required")
  • normal - Boolean Using {} constructor (default "Object.create(null)")


Take a look at my examples

License GPLv3


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free