npm.io
1.2.2 • Published 2 years ago

@types/global-cache

Licence
MIT
Version
1.2.2
Deps
0
Size
6 kB
Vulns
0
Weekly
0
Stars
51.5K

Installation

npm install --save @types/global-cache

Summary

This package contains type definitions for global-cache (https://github.com/ljharb/global-cache#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/global-cache.

index.d.ts

export function clear(): void;
/**
 * @example
 * import * as cache from 'global-cache';
 * import { strict as assert } from 'node:assert';
 *
 * const key = 'key';
 * const value = {};
 *
 * cache.set(key, value);
 * assert.equal(cache.has(key), true);
 *
 * cache.delete(key);
 * assert.equal(cache.has(key), false);
 */
export function _delete(key: unknown): boolean;
export { _delete as delete };
/**
 * @example
 * import * as cache from 'global-cache';
 * import { strict as assert } from 'node:assert';
 *
 * const key = 'key';
 * const value = {};
 * assert.equal(cache.get(key), undefined);
 *
 * cache.set(key, value);
 * assert.equal(cache.get(key), value);
 */
export function get(key: Primitive): unknown;
/**
 * @example
 * import * as cache from 'global-cache';
 * import { strict as assert } from 'node:assert';
 *
 * const key = 'key';
 * const value = {};
 * assert.equal(cache.has(key), false);
 *
 * cache.set(key, value);
 * assert.equal(cache.has(key), true);
 */
export function has(key: Primitive): boolean;
/**
 * @example
 * import * as cache from 'global-cache';
 * import { strict as assert } from 'node:assert';
 *
 * const key = 'key';
 * const value = {};
 * assert.equal(cache.has(key), false);
 *
 * cache.set(key, value);
 * assert.equal(cache.has(key), true);
 */
export function set(key: Primitive, value: unknown): boolean;
export function setIfMissingThenGet<T>(key: Primitive, valueThunk: () => T): T;

export type Primitive = number | string | boolean | bigint | symbol | null | undefined;

Additional Details

  • Last updated: Tue, 07 Nov 2023 0337 GMT
  • Dependencies: none

Credits

These definitions were written by BendingBender.