npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

lazyprop

1.0.1 • Public • Published

lazyprop

Lazy properties for JavaScript. This allows for defining properties that are lazily created using a given function upon first access. Subsequent access to the property exposes the value created by the original function (the function is only called once):

var lazyprop = require('lazyprop')
var obj = {}
lazyprop(obj, 'answer', function() {
  console.log('only called once')
  return 42
})
var answer1 = obj.answer // will console.log
var answer2 = obj.answer // will NOT console.log

Keywords

none

install

npm i lazyprop

Downloadsweekly downloads

0

version

1.0.1

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability