Closed
Description
- Version:
v10.14.1 - Platform:
Mac OS Darwin Kernel Version 18.6.0 - Subsystem:
const util = require('util');
const rx = /a/;
rx.lastIndex = 3;
util.isDeepStrictEqual(rx, /a/); // true
util.inspect(rx, {showHidden: true}); // '{ /a/ [lastIndex]: 3 }'
util.inspect(/a/, {showHidden: true}); // '{ /a/ [lastIndex]: 0 }'
My expectation would have been false
. I see that areSimilarRegExps
does not perform a check on lastIndex
, and keyCheck
performs a comparison of enumerable keys, and lastIndex
is not enumerable. This may be considered correct, but it feels wrong to me.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex
Thankyou for your time and consideration.