node-robocopy icon indicating copy to clipboard operation
node-robocopy copied to clipboard

Use Array.isArray() instead of instanceof Array to handle arrays.

Open jmcouillard opened this issue 7 years ago • 0 comments

To detect correctly arrays, Array.isArray() should be preferred to instanceof Array. This improvement would allow node-robocopy to work correctly in more complex situations, such as when embedded in a Electron or NW.JS application.

This is explained by inaccurate results of instanceof Array when it is used across different context:

However, since instanceof Array doesn't work correctly across iframes/window, Array.isArray() would be more robust solution.

Source: https://stackoverflow.com/a/22289982

jmcouillard avatar Apr 01 '19 21:04 jmcouillard