isMatchRecord.js 532 B

12345678910111213141516
  1. 'use strict';
  2. var has = require('has');
  3. // https://262.ecma-international.org/13.0/#sec-match-records
  4. module.exports = function isMatchRecord(record) {
  5. return (
  6. has(record, '[[StartIndex]]')
  7. && has(record, '[[EndIndex]]')
  8. && record['[[StartIndex]]'] >= 0
  9. && record['[[EndIndex]]'] >= record['[[StartIndex]]']
  10. && String(parseInt(record['[[StartIndex]]'], 10)) === String(record['[[StartIndex]]'])
  11. && String(parseInt(record['[[EndIndex]]'], 10)) === String(record['[[EndIndex]]'])
  12. );
  13. };