regexp-record.js 762 B

123456789101112131415161718192021
  1. 'use strict';
  2. var hasOwn = require('hasown');
  3. var isInteger = require('../isInteger');
  4. module.exports = function isRegExpRecord(value) {
  5. return value
  6. && hasOwn(value, '[[IgnoreCase]]')
  7. && typeof value['[[IgnoreCase]]'] === 'boolean'
  8. && hasOwn(value, '[[Multiline]]')
  9. && typeof value['[[Multiline]]'] === 'boolean'
  10. && hasOwn(value, '[[DotAll]]')
  11. && typeof value['[[DotAll]]'] === 'boolean'
  12. && hasOwn(value, '[[Unicode]]')
  13. && typeof value['[[Unicode]]'] === 'boolean'
  14. && hasOwn(value, '[[CapturingGroupsCount]]')
  15. && typeof value['[[CapturingGroupsCount]]'] === 'number'
  16. && isInteger(value['[[CapturingGroupsCount]]'])
  17. && value['[[CapturingGroupsCount]]'] >= 0;
  18. };