• Home
Name
Date
Size
#Lines
LOC

..--

.npmignoreD12-May-2024105 1614

LICENSED12-May-20241.1 KiB2317

README.mdD12-May-2024806 4532

component.jsonD12-May-2024177 87

lazyProperty.jsD12-May-2024532 2017

package.jsonD12-May-20241.5 KiB6665

README.md

1lazy-property
2=============
3Adds a lazily initialized property to an object.
4
5## Example
6
7```javascript
8var addLazyProperty = require("lazy-property")
9
10var obj = {}
11
12addLazyProperty(obj, "foo", function() {
13  console.log("initialized!")
14  return "bar"
15})
16
17//Access the property
18console.log(obj.foo)
19console.log(obj.foo)
20
21//Prints out:
22//
23//    initialized!
24//    bar
25//    bar
26//
27```
28
29## Install
30
31    npm install lazy-property
32
33## API
34
35### `require("lazy-property")(obj, name, init[, enumerable])`
36Adds a lazily initialized property to the object.
37
38* `obj` is the object to add the property to
39* `name` is the name of the property
40* `init` is a function that computes the value of the property
41* `enumerable` if the property is enumerable (default `false`)
42
43## Credits
44(c) 2013 Mikola Lysenko. MIT License
45