#parameterObject

2024-05-03

Assign properties in a constructor’s parameter object (with defaults) to object being instantiated in JavaScript

codeberg.org/aral/gists/src/br

This is a little something I ended up playing around with this morning before figuring out how to do it (after spending far too much time down a rabbit hole with object destructuring when what I really needed was creative use of the spread operator).

(Useful for custom objects in JSDB 5 – codeberg.org/small-tech/jsdb#c)

#JavaScript #parameterObject #defaults #JSDB

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst