Prefer Spread Over Apply
When passing a list of values as positional arguments, spread the array (`fn(...args)`) instead of calling `fn.apply(null, args)`. When collecting variadic arguments, use rest parameters (`function fn(...…
$ prime install @web-style/rule-prefer-spread-over-apply Projection
Always in _index.xml · the agent never has to ask for this.
PreferSpreadOverApply [rule] v0.1.0
When passing a list of values as positional arguments, spread the array (fn(...args)) instead of calling fn.apply(null, args). When collecting variadic arguments, use rest parameters (function fn(...args)) instead of inspecting the legacy arguments object. Both spread and rest are dedicated syntax for the job, and both compose cleanly with arrow functions.
Loaded when retrieval picks the atom as adjacent / supporting.
PreferSpreadOverApply [rule] v0.1.0
When passing a list of values as positional arguments, spread the array (fn(...args)) instead of calling fn.apply(null, args). When collecting variadic arguments, use rest parameters (function fn(...args)) instead of inspecting the legacy arguments object. Both spread and rest are dedicated syntax for the job, and both compose cleanly with arrow functions.
Checks
- Variadic forwarding is
wrapper(...args), notwrapper.apply(this, args). - Variadic capture is
function fn(...args) { … }, notfunction fn() { var args = arguments; … }. - Array copy is
[...source]orArray.from(source), notsource.slice()followed by mutation patterns. - Object copy / merge is
{ ...source, override }, notObject.assign({}, source, { override })(both work; spread is the style choice).
Label
Prefer the spread operator over .apply() and arguments-based variadic plumbing
Loaded when retrieval picks the atom as a focal / direct hit.
PreferSpreadOverApply [rule] v0.1.0
When passing a list of values as positional arguments, spread the array (fn(...args)) instead of calling fn.apply(null, args). When collecting variadic arguments, use rest parameters (function fn(...args)) instead of inspecting the legacy arguments object. Both spread and rest are dedicated syntax for the job, and both compose cleanly with arrow functions.
Checks
- Variadic forwarding is
wrapper(...args), notwrapper.apply(this, args). - Variadic capture is
function fn(...args) { … }, notfunction fn() { var args = arguments; … }. - Array copy is
[...source]orArray.from(source), notsource.slice()followed by mutation patterns. - Object copy / merge is
{ ...source, override }, notObject.assign({}, source, { override })(both work; spread is the style choice).
Label
Prefer the spread operator over .apply() and arguments-based variadic plumbing
Label
Prefer the spread operator over .apply() and arguments-based variadic plumbing
Source
prime-system/examples/web-style/primes/compiled/@web-style/rule-prefer-spread-over-apply/atom.yaml