14:35 | <bradleymeck> | i kind of wish we had a Object.defineProperties that just took (Object, [...props], {configurable, enumerable, writable}) and modified the listed props |
14:35 | <bradleymeck> | but that seems soo... weird |
16:46 | <ljharb> | bradleymeck: `Object.defineProperties(obj, Object.fromEntries(props.map((prop) => [prop, { configurable, enumerable, writable }])))`? |
16:49 | <bradleymeck> | ljharb: thats quite a mouthful |
16:49 | <bradleymeck> | i'm still not convinced that boilerplate is a good sign even if it shows we can already do things |
16:55 | <ljharb> | well sure, you'd wrap that in an abstraction |
16:55 | <ljharb> | but i'm curious about the use case where you don't care which property has which aspect |
16:56 | <bradleymeck> | setting various props to enumerable all at once, or setting various props to non-configurable/writable; not doing it for all properties |
16:57 | <bradleymeck> | see things like in the DOM standard or classes where you want things to be done prop by prop rather than all or nothing |
16:57 | <ljharb> | ah i suppose since it's not "all props", i can see it making sense |
16:58 | <ljharb> | but also `props.forEach((prop) => Object.defineProperty(obj, prop, { configurable, enumerable, writable }))` |
16:58 | <ljharb> | lots of ways to spell it |