Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 3, 2024 via pnpm

thunky 1.1.0

delay the evaluation of a paramless async function and cache the result
Package summary
Share
0
issues
1
license
1
MIT
Package created
6 Mar 2013
Version published
14 Oct 2019
Maintainers
2
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
thunky@1.1.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of thunky 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does thunky do?

Thunky is a JavaScript library that delays the evaluation of a parameter-less asynchronous function and caches the result. This method is inspired by the concept of 'thunk' in functional programming. This package can be especially useful when implementing lazy evaluation patterns in your application.

How do you use thunky?

To start using Thunky, first install it via npm with the command npm install thunky. Here's an example showcasing how Thunky can be used in your project:

var thunky = require('thunky')

var test = thunky(function (callback) {
  console.log('waiting 1s and returning random number')
  setTimeout(function () {
    callback(Math.random())
  }, 1000)
})

test(function (num) {
  console.log(num) 
})

test(function (num) {
  console.log(num) 
})

In this example, the test function, when called for the first time, waits for 1 second and then returns a random number. Subsequent calls to the function will return the same random number as the first call, effectively showcasing Thunky's caching capability.

Where are the thunky docs?

The Thunky documentation can be found on the package's GitHub repository at git://github.com/mafintosh/thunky.git. Here, you'll find everything from the package's introduction and installation to several usage examples and notes on its functionality. Remember, understanding how Thunky, or any package for that matter, works is crucial for its effective implementation in your projects.