UNPKG

request-mocking-protocol

Version:
25 lines 793 B
"use strict"; /** * Mock response utils. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.patchObject = patchObject; exports.wait = wait; const set_1 = __importDefault(require("lodash/set")); /** * Patches object by provided set of keyPath and value pairs. */ function patchObject(obj, patchSchema) { if (obj && typeof obj === 'object' && patchSchema) { Object.keys(patchSchema).forEach((keyPath) => { (0, set_1.default)(obj, keyPath, patchSchema[keyPath]); }); } } async function wait(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); } //# sourceMappingURL=utils.js.map