lazy-property

WebJar for lazy-property

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

lazy-property
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

lazy-property
WebJar for lazy-property
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mikolalysenko/lazy-property

Download lazy-property

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/lazy-property/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>lazy-property</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/lazy-property/
implementation 'org.webjars.npm:lazy-property:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/lazy-property/
implementation ("org.webjars.npm:lazy-property:1.0.0")
'org.webjars.npm:lazy-property:jar:1.0.0'
<dependency org="org.webjars.npm" name="lazy-property" rev="1.0.0">
  <artifact name="lazy-property" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='lazy-property', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "lazy-property" % "1.0.0"
[org.webjars.npm/lazy-property "1.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

lazy-property

Adds a lazily initialized property to an object.

Example

var addLazyProperty = require("lazy-property")

var obj = {}

addLazyProperty(obj, "foo", function() {
  console.log("initialized!")
  return "bar"
})

//Access the property
console.log(obj.foo)
console.log(obj.foo)

//Prints out:
//
//    initialized!
//    bar
//    bar
//

Install

npm install lazy-property

API

require("lazy-property")(obj, name, init[, enumerable])

Adds a lazily initialized property to the object.

  • obj is the object to add the property to
  • name is the name of the property
  • init is a function that computes the value of the property
  • enumerable if the property is enumerable (default false)

Credits

(c) 2013 Mikola Lysenko. MIT License

Versions

Version
1.0.0