Determine if the JS environment has private fields (class { #x; }) support.
const assert = require('assert'); const hasPrivateFields = require('has-private-fields'); assert.equal(hasPrivateFields(), true); // if the environment has native class private fields support (node v12+) const { hasPrivateAccessors, hasPrivateMethods } = hasPrivateFields; assert.equal(hasPrivateAccessors(), true); // if the environment has native class private accessors support (node v14.6+) assert.equal(hasPrivateMethods(), true); // if the environment has native class private methods support (node v14.6+)Simply clone the repo, npm install, and run npm test
