private-object

1.0.0 • Public • Published

private-object

NPM version build status Test coverage Downloads

Create an immutable enumerable object with ES6 Symbols, getters, setters and Object.lock.

Installation

$ npm install private-object

Usage

const priv = require('private-object')
var boop = priv({foo: 'bar'})

console.log(boop)
// => {}

console.log(boop.foo)
// => 'bar'

console.log(Object.keys(boop))
// => []

boop.bar = 3
console.log(boop, boop.bar)
// => {}, undefined

boop.foo = 'Tobi'
console.log(boop.foo)
// => 'Tobi'

Why?

This is a small experiment to see how far private properties can be pushed and locked down in ES6.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i private-object

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • yoshuawuyts