Skip to main content

Search

Items tagged with: parameterobject


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

https://codeberg.org/aral/gists/src/branch/main/assign-properties-in-a-constructors-parameter-object-with-defaults-to-object-being-instantiated-in-JavaScript.md

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 – https://codeberg.org/small-tech/jsdb#custom-data-types)

#JavaScript #parameterObject #defaults #JSDB