object_setDefault

If object does not have key, add it.

Ekde 2021/06/03. Vidu La ĝisdata versio.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/427473/937462/object_setDefault.js

Aŭtoro
Bogudan
Versio
0.4
Kreita
2021/06/03
Ĝisdatigita
2021/06/03
Size
396 bitokoj
Licenco
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