Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

es.regexp.test.js 951B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. // TODO: Remove from `core-js@4` since it's moved to entry points
  3. require('../modules/es.regexp.exec');
  4. var $ = require('../internals/export');
  5. var isObject = require('../internals/is-object');
  6. var DELEGATES_TO_EXEC = function () {
  7. var execCalled = false;
  8. var re = /[ac]/;
  9. re.exec = function () {
  10. execCalled = true;
  11. return /./.exec.apply(this, arguments);
  12. };
  13. return re.test('abc') === true && execCalled;
  14. }();
  15. var nativeTest = /./.test;
  16. // `RegExp.prototype.test` method
  17. // https://tc39.es/ecma262/#sec-regexp.prototype.test
  18. $({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, {
  19. test: function (str) {
  20. if (typeof this.exec !== 'function') {
  21. return nativeTest.call(this, str);
  22. }
  23. var result = this.exec(str);
  24. if (result !== null && !isObject(result)) {
  25. throw new Error('RegExp exec method returned something other than an Object or null');
  26. }
  27. return !!result;
  28. }
  29. });