ljharb

ljharb/mock-property

Given an object and a property, replaces a property descriptor (or deletes it), and returns a thunk to restore it.

JavaScript
7
1
MIT License

mock-property is a utility library that allows developers to temporarily replace or delete a property descriptor on an object, and then restore it later using a provided thunk. It is designed for testing scenarios where mocking object properties is necessary, such as when testing code that relies on getters, setters, or other property behaviors. This library is particularly useful for JavaScript developers writing unit tests who need to isolate and control object property behavior.

Total donated
Undistributed
Share with your subscribers:

Recipients

How the donated funds are distributed

Support the dependencies

Support the repos that depend on this repository

Top contributors

ljharb's profile
ljharb
39 contributions

Recent events

Kivach works on the Obyte network, and therefore you can track all donations.

No events yet