app.let

0.1.6 • Public • Published

app.let

"app.let" polyfills 'let' for Object props. Additionally, it also provides a 'private' Map for Objects

applet = require('app.let')()

By default trying to reset an Object's property that is a 'let' property does not throw errors. To throw errors:

applet = require('app.let')({strict:true})

The 'app.let' Symbol('@let') can also be customized:

applet = require('app.let')({ symbol:'custom-symbol' })

app.let is class Leter

class Leter extends Map
get symbol() => Symbol
get name() => Symbol string value
get privates() => Leter private map
get isLeter() => true

def(obj) => obj w/ let defined
priv(obj) => obj w/ private Map defined
sudo(obj) => get or set if not defined obj's private Map

app.let use:

applet=require('app.let')()
obj=applet.def( { hello:'world' } )


obj.let('hello')
obj.hello = 'saturn'
obj.hello // returns 'world' or if strict throws Error

applet.sudo(obj).set('hello','private world')
applet.sudo(obj).get('hello') // 'private world'

Notes:

- app.let uses Object.watch or watch (sans unwatch) polyfill from https://gist.github.com/eligrey/384583

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.6
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.6
    1

Package Sidebar

Install

npm i app.let

Weekly Downloads

1

Version

0.1.6

License

MIT

Last publish

Collaborators

  • fcampas