plopjs / plop

Consistency Made Simple
http://plopjs.com
MIT License
7.06k stars 277 forks source link

[node-plop] instanceof Array is not working with array from vm script #404

Open niandalu opened 10 months ago

niandalu commented 10 months ago

There's a validation for generator.actions while running runGeneratorActions.

I'm using vm to load plopfile and programmatically register it to node plop api instance. But the instanceof Array would fail when the actions come from vm script. Maybe node-plop should use Array.isArray instead.

const vm = require('vm')
const s = new vm.Script(`[]`).runInNewContext()
s instanceof Array // false
Array.isArray(s) // true

Related to https://github.com/nodejs/node/issues/37921