Sha256: 3a62ac58b04c2a47b3db76090e754a70cfae1d9606b079d265c601b19f5b796d

Contents?: true

Size: 1.36 KB

Versions: 21

Compression:

Stored size: 1.36 KB

Contents

'use strict';

var anObject = require('./_an-object');
var toLength = require('./_to-length');
var advanceStringIndex = require('./_advance-string-index');
var regExpExec = require('./_regexp-exec-abstract');

// @@match logic
require('./_fix-re-wks')('match', 1, function (defined, MATCH, $match, maybeCallNative) {
  return [
    // `String.prototype.match` method
    // https://tc39.github.io/ecma262/#sec-string.prototype.match
    function match(regexp) {
      var O = defined(this);
      var fn = regexp == undefined ? undefined : regexp[MATCH];
      return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
    },
    // `RegExp.prototype[@@match]` method
    // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
    function (regexp) {
      var res = maybeCallNative($match, regexp, this);
      if (res.done) return res.value;
      var rx = anObject(regexp);
      var S = String(this);
      if (!rx.global) return regExpExec(rx, S);
      var fullUnicode = rx.unicode;
      rx.lastIndex = 0;
      var A = [];
      var n = 0;
      var result;
      while ((result = regExpExec(rx, S)) !== null) {
        var matchStr = String(result[0]);
        A[n] = matchStr;
        if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
        n++;
      }
      return n === 0 ? null : A;
    }
  ];
});

Version data entries

21 entries across 18 versions & 4 rubygems

Version Path
immosquare-cleaner-0.1.52 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.51 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.50 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.49 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.48 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.47 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.46 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.45 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.44 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.43 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.42 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.41 node_modules/core-js/modules/es6.regexp.match.js
immosquare-cleaner-0.1.40 node_modules/core-js/modules/es6.regexp.match.js
optimacms-0.1.61 spec/dummy/node_modules/babel-runtime/node_modules/core-js/modules/es6.regexp.match.js
ilog-0.4.1 node_modules/babel-runtime/node_modules/core-js/modules/es6.regexp.match.js
ilog-0.4.1 node_modules/babel-register/node_modules/core-js/modules/es6.regexp.match.js
ilog-0.4.0 node_modules/babel-runtime/node_modules/core-js/modules/es6.regexp.match.js
ilog-0.4.0 node_modules/babel-register/node_modules/core-js/modules/es6.regexp.match.js
ilog-0.3.3 node_modules/babel-runtime/node_modules/core-js/modules/es6.regexp.match.js
ilog-0.3.3 node_modules/babel-register/node_modules/core-js/modules/es6.regexp.match.js