1.1.1 • Published 6 years ago

sand-require v1.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

sand-require Build Status

require modules as sandboxed objects

What

To treat the required module as a sandboxed object, you need to avoid passing by reference somehow. There are two ways to do that. That's deep-copying or overwriting the setter of the module object. This sand-require realizes the latter. The object created through the sand-require is an object that internally generates a recursive Proxy object and allows only the getter call.

Installation

$ npm install --save sand-require

Quick example

const sandRequire = require('sand-require')
const http = sandRequire('http')

console.log(http.STATUS_CODES['200'])
// => OK

delete http.STATUS_CODES // nothing happens
console.log(http.STATUS_CODES['200'])
// => OK
1.1.1

6 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago