Socket
Socket
Sign inDemoInstall

cacheable-lookup

Package Overview
Dependencies
0
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.4 to 6.1.0

5

index.d.ts

@@ -7,2 +7,3 @@ import {Resolver, promises as dnsPromises, lookup} from 'dns';

export type IPFamily = 4 | 6;
export type EntrySource = 'query' | 'cache';

@@ -76,2 +77,6 @@ type TPromise<T> = T | Promise<T>;

readonly expires?: number;
/**
* Whether this entry comes from the cache or a query
*/
readonly source?: EntrySource;
}

@@ -78,0 +83,0 @@

2

package.json
{
"name": "cacheable-lookup",
"version": "6.0.4",
"version": "6.1.0",
"description": "A cacheable dns.lookup(…) that respects TTL",

@@ -5,0 +5,0 @@ "engines": {

@@ -159,2 +159,8 @@ # cacheable-lookup

#### source
**Note**: This is not present when falling back to `dns.lookup(...)`!
Whether this entry was loaded from the cache or came from a query (`cache` or `query`)
### Entry object (callback-style)

@@ -161,0 +167,0 @@

@@ -163,3 +163,3 @@ 'use strict';

} else {
callback(null, result.address, result.family, result.expires, result.ttl);
callback(null, result.address, result.family, result.expires, result.ttl, result.source);
}

@@ -215,2 +215,3 @@ }, callback);

async query(hostname) {
let source = 'cache';
let cached = await this._cache.get(hostname);

@@ -224,2 +225,3 @@

} else {
source = 'query';
const newPromise = this.queryAndCache(hostname);

@@ -237,3 +239,3 @@ this._pending[hostname] = newPromise;

cached = cached.map(entry => {
return {...entry};
return {...entry, source};
});

@@ -240,0 +242,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc