@types/global-cache
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

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 03:09:37 GMT
  • Dependencies: none

Credits

These definitions were written by BendingBender.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/global-cache

Weekly Downloads

221

Version

1.2.2

License

MIT

Unpacked Size

5.64 kB

Total Files

5

Last publish

Collaborators

  • types