If object does not have key, add it.
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/427473/937453/object_setDefault.js
// ==UserScript==
// @name object_setDefault
// @namespace bo.gd.an[at]rambler.ru
// @version 0.1
// @description If object does not have key, add it.
// @author Bogudan
// @license LGPLv3
// @include https://localhost/
// ==/UserScript==
object.prototype.setDefault = function (key, value) {
if (!(key in this))
this [key] = value;
};