UNPKG

zurvan

Version:

A library for simulating time in Node.js

14 lines (11 loc) 345 B
'use strict'; function FieldOverrider(objectRef, fieldName, newValue) { this.objectRef = objectRef; this.fieldName = fieldName; this.oldValue = objectRef[fieldName]; objectRef[fieldName] = newValue; } FieldOverrider.prototype.restore = function() { this.objectRef[this.fieldName] = this.oldValue; }; module.exports = FieldOverrider;