Comparing version 0.0.0 to 1.0.0
{ | ||
"name": "fn-getter", | ||
"description": "Simple. lazyily evaluated values", | ||
"version": "0.0.0", | ||
"description": "Simple, lazyily evaluated values.", | ||
"version": "1.0.0", | ||
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
# fn-getter | ||
Simple. lazyily evaluated values. | ||
[![NPM version][npm-image]][npm-url] | ||
@@ -13,2 +11,30 @@ [![Build status][travis-image]][travis-url] | ||
Simple, lazyily evaluated values. | ||
If a value takes too long to calculate, | ||
but you don't need it right away (ex. on startup), | ||
then evaluate lazily. | ||
```js | ||
const createGetter = require('fn-getter') | ||
const createS3Client = createGetter(() => { | ||
const AWS = require('aws-sdk') | ||
return new AWS.S3() | ||
}) | ||
``` | ||
Maybe you want to evaluate it after the first time: | ||
```js | ||
setImmediate(createS3Client) | ||
``` | ||
Then, when you need to use it: | ||
```js | ||
app.use((req, res, next) => { | ||
createS3Client().putObject(...) | ||
}) | ||
``` | ||
[npm-image]: https://img.shields.io/npm/v/fn-getter.svg?style=flat-square | ||
@@ -15,0 +41,0 @@ [npm-url]: https://npmjs.org/package/fn-getter |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3699
1
51