@ledgerhq/live-network
Advanced tools
Comparing version 1.2.0 to 1.2.1-nightly.0
# @ledgerhq/live-network | ||
## 1.2.1-nightly.0 | ||
### Patch Changes | ||
- Updated dependencies [[`dd1d17f`](https://github.com/LedgerHQ/ledger-live/commit/dd1d17fd3ce7ed42558204b2f93707fb9b1599de)]: | ||
- @ledgerhq/errors@6.16.4-nightly.0 | ||
## 1.2.0 | ||
@@ -4,0 +11,0 @@ |
import LRU from "lru-cache"; | ||
export type CacheOptions = LRU.Options<string, unknown>; | ||
export declare function seconds(num: number, max?: number): CacheOptions; | ||
export declare function minutes(num: number, max?: number): CacheOptions; | ||
export declare function hours(num: number, max?: number): CacheOptions; | ||
export type CacheRes<A extends Array<any>, T> = { | ||
@@ -3,0 +7,0 @@ (...args: A): Promise<T>; |
import LRU from "lru-cache"; | ||
export function seconds(num, max = 100) { | ||
return { | ||
max, | ||
ttl: num * 1000, | ||
}; | ||
} | ||
export function minutes(num, max = 100) { | ||
return seconds(num * 60, max); | ||
} | ||
export function hours(num, max = 100) { | ||
return minutes(num * 60, max); | ||
} | ||
/** | ||
@@ -3,0 +15,0 @@ * Creates an LRU cache function that wraps the given async function `f`. |
import LRU from "lru-cache"; | ||
export type CacheOptions = LRU.Options<string, unknown>; | ||
export declare function seconds(num: number, max?: number): CacheOptions; | ||
export declare function minutes(num: number, max?: number): CacheOptions; | ||
export declare function hours(num: number, max?: number): CacheOptions; | ||
export type CacheRes<A extends Array<any>, T> = { | ||
@@ -3,0 +7,0 @@ (...args: A): Promise<T>; |
@@ -6,4 +6,19 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.makeLRUCache = void 0; | ||
exports.makeLRUCache = exports.hours = exports.minutes = exports.seconds = void 0; | ||
const lru_cache_1 = __importDefault(require("lru-cache")); | ||
function seconds(num, max = 100) { | ||
return { | ||
max, | ||
ttl: num * 1000, | ||
}; | ||
} | ||
exports.seconds = seconds; | ||
function minutes(num, max = 100) { | ||
return seconds(num * 60, max); | ||
} | ||
exports.minutes = minutes; | ||
function hours(num, max = 100) { | ||
return minutes(num * 60, max); | ||
} | ||
exports.hours = hours; | ||
/** | ||
@@ -10,0 +25,0 @@ * Creates an LRU cache function that wraps the given async function `f`. |
{ | ||
"name": "@ledgerhq/live-network", | ||
"version": "1.2.0", | ||
"version": "1.2.1-nightly.0", | ||
"description": "Ledger Live network and cache utilities", | ||
@@ -55,3 +55,3 @@ "keywords": [ | ||
"lru-cache": "^7.14.1", | ||
"@ledgerhq/errors": "^6.16.3", | ||
"@ledgerhq/errors": "^6.16.4-nightly.0", | ||
"@ledgerhq/live-env": "^2.0.0", | ||
@@ -58,0 +58,0 @@ "@ledgerhq/live-promise": "^0.0.3", |
import LRU from "lru-cache"; | ||
export type CacheOptions = LRU.Options<string, unknown>; //{ max: number; ttl: number }; | ||
export function seconds(num: number, max = 100): CacheOptions { | ||
return { | ||
max, | ||
ttl: num * 1000, | ||
}; | ||
} | ||
export function minutes(num: number, max = 100): CacheOptions { | ||
return seconds(num * 60, max); | ||
} | ||
export function hours(num: number, max = 100): CacheOptions { | ||
return minutes(num * 60, max); | ||
} | ||
export type CacheRes<A extends Array<any>, T> = { | ||
@@ -4,0 +18,0 @@ (...args: A): Promise<T>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82709
1155
2