Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fn-getter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fn-getter - npm Package Compare versions

Comparing version 0.0.0 to 1.0.0

4

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc