es6.regexp.match.js 385 B

12345678910
  1. // @@match logic
  2. require('./_fix-re-wks')('match', 1, function (defined, MATCH, $match) {
  3. // 21.1.3.11 String.prototype.match(regexp)
  4. return [function match(regexp) {
  5. 'use strict';
  6. var O = defined(this);
  7. var fn = regexp == undefined ? undefined : regexp[MATCH];
  8. return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  9. }, $match];
  10. });