You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

string-replace-async

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-replace-async - npm Package Compare versions

Comparing version

to
1.2.0

19

index.js

@@ -44,5 +44,4 @@ 'use strict';

return prev.then(function (ret) {
return assignReplacement(match, replacer).then(function (match) {
ret.push(match);
return ret;
return assignReplacement(match, replacer).then(function (res) {
return ret.concat([res]);
});

@@ -63,3 +62,3 @@ });

if (typeof replacer === 'string') {
return Promise.resolve(str.replace(re, replacer));
return str.replace(re, replacer);
}

@@ -79,10 +78,18 @@

function fn(str, re, replacer, seq) {
try {
return Promise.resolve(processString(str, re, replacer, seq));
} catch (e) {
return Promise.reject(e);
}
}
function stringReplaceAsync(str, re, replacer) {
return processString(str, re, replacer, false);
return fn(str, re, replacer, false);
}
stringReplaceAsync.seq = function (str, re, replacer) {
return processString(str, re, replacer, true);
return fn(str, re, replacer, true);
};
module.exports = stringReplaceAsync;
{
"name": "string-replace-async",
"version": "1.1.0",
"version": "1.2.0",
"description": "Asynchronous String.prototype.replace()",

@@ -5,0 +5,0 @@ "license": "MIT",