meta-for
v0.0.2
Published
Get and set your own un-collidable meta properties on objects. Powered by Symbols.
Downloads
4
Maintainers
Readme
meta-for
Get and set your own un-collidable meta properties on objects. Powered by Symbols.
Install
$ npm install --save meta-for
Usage
import metaFor from 'meta-for';
let obj = {};
let meta = metaFor(obj); // meta is writable
meta.someMetaProperty = true;
let meta = metaFor(obj, true); // meta is read-only
meta.someMetaProperty === true
for (var prop in obj) {
// The meta property won't appear here!
// It's also impossible to collide with another property,
// thanks to the magic of Symbols
}