meta-for

v0.0.2
Get and set your own un-collidable meta properties on objects. Powered by Symbols.
meta symbol properties private accessor

meta-for NPM version Build Status Dependency Status Coverage percentage

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
}
npm i meta-for

Metadata

  • MIT
  • Whatever
  • Dave Wasmer
  • released 8/4/2015

Downloads

Maintainers