Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

known

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

known

Allow only access to known object properties using ES6 Proxy

Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

known Build Status

Allow only access to known object properties using ES6 Proxy

Proxies are objects for which the programmer has to define the semantics in JavaScript. The default object semantics are implemented in the JavaScript engine, often written in lower-level languages like C++. Proxies let the programmer define most of the behavior of an object in JavaScript. They are said to provide a meta-programming API.

Usage

$ npm install --save known
var known = require('known');

var obj = {foo: true};

console.log(obj.bar);
//=> undefined

obj = known(obj);

// throws a TypeError when you try to access an unknown property
console.log(obj.bar);
//=> [TypeError] Unknown property: bar

Compatibility

  • Node >=0.8.0 - with the harmony flag: node --harmony
  • Chrome - with the this flag enabled chrome://flags/#enable-javascript-harmony (copy/paste into address-bar)
  • Firefox >=12

License

MIT © Sindre Sorhus

Keywords

object

FAQs

Package last updated on 30 Jan 2015

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