object_setDefault

If object does not have key, add it.

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.greasyfork.org/scripts/427473/937466/object_setDefault.js

作者
Bogudan
版本
0.5
建立日期
2021-06-03
更新日期
2021-06-03
授權條款
LGPLv3

Added method setDefault to object prototype.

function setDefault (key, value)

If object does not have key, add it with value value

key (string, required)
    key to check
value (any, optional, default = undefined)
    value for key if it's not present