Destructure Objects And Arrays
When a function reads more than one property of an object — its parameter, its return value, or any local — pull them out with destructuring.…
$ prime install @web-style/rule-destructure-objects-and-arrays Projection
Always in _index.xml · the agent never has to ask for this.
DestructureObjectsAndArrays [rule] v0.1.0
When a function reads more than one property of an object — its parameter, its return value, or any local — pull them out with destructuring. When a function returns several named values, return an object and let the caller destructure; do not return an array unless the order is meaningful and stable forever.
Loaded when retrieval picks the atom as adjacent / supporting.
DestructureObjectsAndArrays [rule] v0.1.0
When a function reads more than one property of an object — its parameter, its return value, or any local — pull them out with destructuring. When a function returns several named values, return an object and let the caller destructure; do not return an array unless the order is meaningful and stable forever.
Checks
- Multi-property reads use
const { a, b } = sourcerather than repeatedsource.a,source.b. - Function parameters that are options bags are destructured in the signature:
function fn({ id, name }) { … }. - Multi-value returns are objects, not positional arrays — except for canonical ordered pairs (e.g. React's
useState). - Defaults inside destructuring are written
const { a = 0, b = '' } = source.
Label
Destructure when accessing multiple properties; prefer object destructuring for multi-value returns
Loaded when retrieval picks the atom as a focal / direct hit.
DestructureObjectsAndArrays [rule] v0.1.0
When a function reads more than one property of an object — its parameter, its return value, or any local — pull them out with destructuring. When a function returns several named values, return an object and let the caller destructure; do not return an array unless the order is meaningful and stable forever.
Checks
- Multi-property reads use
const { a, b } = sourcerather than repeatedsource.a,source.b. - Function parameters that are options bags are destructured in the signature:
function fn({ id, name }) { … }. - Multi-value returns are objects, not positional arrays — except for canonical ordered pairs (e.g. React's
useState). - Defaults inside destructuring are written
const { a = 0, b = '' } = source.
Label
Destructure when accessing multiple properties; prefer object destructuring for multi-value returns
Label
Destructure when accessing multiple properties; prefer object destructuring for multi-value returns
Source
prime-system/examples/web-style/primes/compiled/@web-style/rule-destructure-objects-and-arrays/atom.yaml