1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-05 12:37:15 -05:00
notes/node_modules/execall/index.js

24 lines
366 B
JavaScript
Raw Normal View History

2017-03-09 13:16:08 -05:00
'use strict';
var cloneRegexp = require('clone-regexp');
module.exports = function (input, str) {
var match;
var matches = [];
var re = cloneRegexp(input);
var isGlobal = re.global;
while (match = re.exec(str)) {
matches.push({
match: match[0],
sub: match.slice(1),
index: match.index
})
if (!isGlobal) {
break;
}
}
return matches;
};