question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What is the best way to deal with array-like, but not true Array collections in Illustrator

See original GitHub issue

I would like to use the forEach() function on app.activeDocument.pageItems, but it is not a proper Array. I tried to get around this by using Array.from(app.activeDocument.pageItems), but this does not appear to be an available function. I was successful using [].concat(app.activeDocument.pageItems). Is this the most efficient way to make pageItems into an Array? Is there a way to use forEach() with the non-Array, but array like collections in Illustrator?

Perhaps there should be a warning about these array like collections in the readme.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gotnonecommented, Feb 12, 2021

I believe that babel upstream may be the better avenue for getting a solution. Thanks for looking into this.

0reactions
ff6347commented, Feb 3, 2021

You could fork extendscriptr and modify your fork as you like

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Misleading scripting guide? PathPoints index - 7387469
Solved: Hello, I've had trouble finding how to access the PathPoint positions today. Apparently, the correct way to do it is by writing...
Read more >
Best way to create an array of objects in Illustrator? - Super User
Go to Effects -> Distort/Trasnform -> Transform... Add amount of copies you want then play with the array controls.
Read more >
What causes a java.lang.ArrayIndexOutOfBoundsException ...
The only place this should change value is to keep the loop going. Changing it otherwise is just risking an exception, and is...
Read more >
1. Introduction to Groovy - Programming Grails [Book] - O'Reilly
But Groovy extends this in convenient ways. null object references evaluate to false . Nonempty collections, arrays, and maps; iterators and enumerations with ......
Read more >
Underscore.js
Note: Collection functions work on arrays, objects, and array-like objects ... or passing false or Infinity, flattens the array all the way to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found