characters(container, [cb])
Returns a collection of all character objects in the given container. The container object can be a Document, Page, Layer, Group, Story, Text Frame, Paragraph, Line or Word.
If a callback function is given, characters()
calls this callback function on each character object of the given container. When the callback function returns false, the loop stops and the characters()
function returns an array of all characters up to this point.
Type: function
Parameter(s):
- container {Document | Page | Layer | Group | Story | TextFrame | Paragraph | Line | Word}:
The document, page, layer, group, story, textFrame, paragraph, line or word instance to iterate the characters in.
- cb {Function} Optional:
Optional: The callback function to call with each character. When this function returns false the loop stops. Passed arguments:
character
,loopCount
Returns:
-
{Characters | Array}:
A collection or an array of Character objects.