Skip to content

Instantly share code, notes, and snippets.

View lawrencegripper's full-sized avatar

Lawrence Gripper lawrencegripper

View GitHub Profile
@lawrencegripper
lawrencegripper / make_writable.js
Last active July 12, 2023 23:00 — forked from moehlone/make_writable.js
Make JavaScript readonly propertys writable (example for overwriting navigator.userAgent; useful for unit tests -> browser detection)
/**
* Creates a read/writable property which returns a function set for write/set (assignment)
* and read/get access on a variable
*
* @param {Any} value initial value of the property
*/
function createProperty(value) {
var _value = value;
/**