With global property:
asyncReplace("aaa", /(\d)/g, function(){}, function(){})
/tmp/node-test/node_modules/async-replace/async-replace.js:36
while(matched.length > 0) {
^
TypeError: Cannot read property 'length' of null
at module.exports (/tmp/node-test/node_modules/async-replace/async-replace.js:36:18)
Without global property:
asyncReplace("aaa", /(\d)/, function(){}, function(){})
/tmp/node-test/node_modules/async-replace/async-replace.js:13
var args = matched.slice();
^
TypeError: Cannot call method 'slice' of null
at replaceLocal (/tmp/node-test/node_modules/async-replace/async-replace.js:13:24)
To fix this errors please add this code after "var matched = string.match(regexp);" strings in source:
if (!matched) return callback(null, string);
It will return not modified source string to callback function.
To fix this errors please add this code after "var matched = string.match(regexp);" strings in source:
It will return not modified source string to callback function.
Thanks!