New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cached-lookup

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cached-lookup - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

types/index.d.ts

9

index.js

@@ -9,4 +9,3 @@ class CachedLookup {

// Ensure lookup is a function type
if (typeof lookup !== 'function')
throw new Error('new CachedLookup(lookup) -> lookup must be a Function');
if (typeof lookup !== 'function') throw new Error('new CachedLookup(lookup) -> lookup must be a Function');
this.#lookup = lookup;

@@ -44,2 +43,6 @@ }

cached(max_age) {
// Ensure max_age is a valid greater than zero number
if (typeof max_age !== 'number' || max_age < 0)
throw new Error('CachedLookup.cached(max_age) -> max_age must be a number that is greater than zero.');
// Return value from cache if it is still valid

@@ -91,3 +94,3 @@ if (this._is_cache_valid(max_age)) return Promise.resolve(this.#value);

/**
* Expires current cached value by setting its timestamp to 0
* Expires the current cached value.
*/

@@ -94,0 +97,0 @@ expire() {

{
"name": "cached-lookup",
"version": "3.0.0",
"version": "3.0.1",
"description": "A Simple Package To Cache And Save On Expensive Lookups & Operations.",
"main": "index.js",
"types": "./types/index.d.ts",
"scripts": {

@@ -20,4 +21,5 @@ "test": "echo \"Error: no test specified\" && exit 1"

"intermittent",
"expensive",
"efficient"
"efficient",
"async",
"fast"
],

@@ -24,0 +26,0 @@ "author": "kartikk221",

@@ -19,5 +19,8 @@ # CachedLookup: A Simple Package To Cache And Save On Expensive Lookups & Operations.

- Simple-to-use API
- TypeScript Support
- Asynchronous By Nature
- Customizable Cache Lifetime
- Dynamic Cache Consumption
- Extremely Lightweight
- Customizable Cache Lifetime
- No Dependencies

@@ -24,0 +27,0 @@ ## Installation

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