Skip to content
Allow only access to known object properties using ES2015 Proxy
JavaScript TypeScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig Require Node.js 6 Jan 13, 2018
.gitattributes Require Node.js 8, add TypeScript definition (#3) Apr 21, 2019
.gitignore
.npmrc Require Node.js 6 Jan 13, 2018
.travis.yml Require Node.js 8, add TypeScript definition (#3) Apr 21, 2019
index.d.ts Require Node.js 8, add TypeScript definition (#3) Apr 21, 2019
index.js Require Node.js 6 Jan 13, 2018
index.test-d.ts Require Node.js 8, add TypeScript definition (#3) Apr 21, 2019
license Require Node.js 6 Jan 13, 2018
package.json 3.0.0 Apr 21, 2019
readme.md Require Node.js 8, add TypeScript definition (#3) Apr 21, 2019
test.js Require Node.js 8, add TypeScript definition (#3) Apr 21, 2019

readme.md

known Build Status

Allow only access to known object properties using ES2015 Proxy

Usage

$ npm install known
const known = require('known');

const object = {foo: true};

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

const object2 = known(object);

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

Related

  • on-change - Watch an object or array for changes (Uses Proxy too)
  • negative-array - Negative array index support (Uses Proxy too)

License

MIT © Sindre Sorhus

You can’t perform that action at this time.