UNPKG

@hirez_io/auto-spies-core

Version:

Create automatic spies from classes in tests, also for promises and observables, used as a common code for jasmine-auto-spies and jest-auto-spies

21 lines (17 loc) 425 B
import { stringify } from 'javascript-stringify'; export class ArgsMap { private map: { [key: string]: any } = {}; set(key: unknown, value: unknown): void { const keyAsString = stringify(key); if (keyAsString) { this.map[keyAsString] = value; } } get(key: unknown): any { const keyAsString = stringify(key); if (!keyAsString) { return; } return this.map[keyAsString]; } }