File Explorer

/var/runtime/node_modules/@aws-sdk/node_modules/obliterator

This explorer reads the filesystem of the server it runs on, so /workspace/user isn't present here. Browsing and the terminal still work against this server's own disk from /.

0 dirs
33 files
match.js969 B · 43 lines
/** * Obliterator Match Function * =========================== * * Function returning an iterator over the matches of the given regex on the * target string. */var Iterator = require('./iterator.js'); /** * Match. * * @param  {RegExp}   pattern - Regular expression to use. * @param  {string}   string  - Target string. * @return {Iterator} */module.exports = function match(pattern, string) {  var executed = false;   if (!(pattern instanceof RegExp))    throw new Error('obliterator/match: invalid pattern. Expecting a regular expression.');   if (typeof string !== 'string')    throw new Error('obliterator/match: invalid target. Expecting a string.');   return new Iterator(function() {    if (executed && !pattern.global) {      pattern.lastIndex = 0;      return {done: true};    }     executed = true;     var m = pattern.exec(string);     if (m)      return {value: m};     pattern.lastIndex = 0;    return {done: true};  });};