lazylet is a lazy-evaluation system for use in your specs.
Variables are defined within an environment object and are lazily computed on demand. A variable can hold either a value, function or object. If the variable is a function it used for computing the value of the variable when it is accessed from the environment.
Variables are accessed from the environment as if they are plain JS properties. Under the hood, the properties are defined using Object.defineProperty with a 'get' accessor in order that their value can be computed on demand.
WARNING: LazyLet is not yet stable. The API may change significantly before 1.0.0 and there may be show-stopping bugs.
Add it to your package.json or
npm install lazylet.
var LazyLet = env = LazyLet Let = envLet;;
To set a variable with a value that is a function, nest it within another function (to avoid ambiguity with dynamically computing a value), like so:
Running the specs
wach node module if you would like to have the specs run
automatically when the source or specs are modified.
npm install -g wach
- Fork it ( https://github.com/freshtonic/lazylet/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request
Copyright (c) 2014, lazylet is developed and maintained by James Sadler, and is released under the open MIT Licence.