Universal noop proxy — any property access, method call, new construct,
or function application returns the noop itself. Never throws, never rejects.
Use as a drop-in mock for any dependency: noop.db.query('SELECT 1'), noop.config.get('key'),
await noop.asyncMethod(), for (const x of noop.items) {}, JSON.stringify(noop).
Important:typeof noop returns 'function' because the Proxy target is a function.
This is a JavaScript limitation (typeof is not interceptable by Proxy).
Example
import { noop } from'@biorate/unimock';
constservice = newService(noop); // noop as any dependency service.run(); // noop methods called internally — no crash
Description
Universal noop proxy — any property access, method call,
newconstruct, or function application returns thenoopitself. Never throws, never rejects.Use as a drop-in mock for any dependency:
noop.db.query('SELECT 1'),noop.config.get('key'),await noop.asyncMethod(),for (const x of noop.items) {},JSON.stringify(noop).Important:
typeof noopreturns'function'because the Proxy target is a function. This is a JavaScript limitation (typeofis not interceptable by Proxy).Example