fn-getter

Simple, lazyily evaluated values.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
fn-getter
901.0.08 years ago8 years agoMinified + gzip package size for fn-getter in KB

Readme

fn-getter
!NPM versionnpm-imagenpm-url !Build statustravis-imagetravis-url !Test coveragecodecov-imagecodecov-url !Dependency Statusdavid-imagedavid-url !Licenselicense-imagelicense-url !Downloadsdownloads-imagedownloads-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.
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:
setImmediate(createS3Client)

Then, when you need to use it:
app.use((req, res, next) => {
  createS3Client().putObject(...)
})