Module:Util/tables/iteratee/Documentation: Difference between revisions
PhantomCaleb (talk | contribs) (Created page with "{{#invoke:Documentation|Module}}") |
PhantomCaleb (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
An '''iteratee''' is a function called by an iterating function (such as [[Module:Util/tables/map|map]] or [[Module:Util/tables/filter|filter]]) as it iterates over an array. The iteratee is called for each array element, with the element as its sole argument. | |||
When iterating over arrays of objects, the <code>iteratee</code> function on this page helps create iteratees from shorthands: | |||
* The <code>property</code> iteratee is created from a string value that names an object property. The iteratee takes an object and returns its value for that property. | |||
* The <code>match</code> iteratee is created from an object (object A). The iteratee takes an object (object B) and returns <code>true</code> if B matches A. B matches A if it has all the same property values as A. B may have additional properties that A doesn't have. | |||
This function is only intended for use by iterator functions in [[Module:Util/tables]] and '''should not be used directly'''. | |||
==Definition== | |||
{{#invoke:Documentation|Module}} | {{#invoke:Documentation|Module}} |
Revision as of 21:55, 12 May 2024
An iteratee is a function called by an iterating function (such as map or filter) as it iterates over an array. The iteratee is called for each array element, with the element as its sole argument.
When iterating over arrays of objects, the iteratee
function on this page helps create iteratees from shorthands:
- The
property
iteratee is created from a string value that names an object property. The iteratee takes an object and returns its value for that property. - The
match
iteratee is created from an object (object A). The iteratee takes an object (object B) and returnstrue
if B matches A. B matches A if it has all the same property values as A. B may have additional properties that A doesn't have.
This function is only intended for use by iterator functions in Module:Util/tables and should not be used directly.
Definition
Lua error in Module:Documentation/Module at line 249: attempt to index local 'spec' (a function value).