Determine whether the provided would be valid as the name of a ECMAScript 5.1 variable.
var JavaScript = require('machinepack-javascript');
// Determine whether the provided would be valid as the name of a ECMAScript 5.1 variable.
JavaScript.validateVarname({
string: 'foo$barz',
}).execSync();
The string to inspect.
'foo$barz'
An unexpected error occurred.
The specified string cannot be coerced into a valid ECMAScript 5.1-compatible variable name. It might have inappropriate characters or collide with a JavaScript reserved word (e.g. `if` or `for`).
OK.