Should I check NODE_MODULE_VERSION or V8_MAJOR_VERSION/V8_MINOR_VERSION?

62 Views Asked by At

I'm working on a native module for Node.js and I see that there's two ways to check which V8 version it's being run on:

#if (V8_MAJOR_VERSION < 9 || (V8_MAJOR_VERSION == 9 && V8_MINOR_VERSION < 4))

or

#if defined NODE_MODULE_VERSION && NODE_MODULE_VERSION < 93

I like the first way because it doesn't require learning what NODE_MODULE_VERSION is and then looking up in two tables (for Node and Electron) to see what it actually means but it's shorter and seems like it might be safer to be less granular. Are there any other considerations over which way to pick?

0

There are 0 best solutions below