{"_id":"async-replace","_rev":"156286","name":"async-replace","description":"Run replace on a string and update it asynchronous","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"kesla","email":""}],"time":{"modified":"2021-06-03T11:36:34.000Z","created":"2013-02-20T17:21:22.471Z","1.0.1":"2015-11-07T05:31:18.271Z","1.0.0":"2014-06-02T20:59:01.973Z","0.0.2":"2013-05-26T21:50:36.921Z","0.0.1":"2013-02-20T17:21:22.471Z"},"users":{},"author":{"name":"David Björklund","email":"david.bjorklund@gmail.com"},"repository":{"type":"git","url":"git://github.com/kesla/async-replace.git"},"versions":{"1.0.1":{"name":"async-replace","version":"1.0.1","description":"Run replace on a string and update it asynchronous","main":"async-replace.js","directories":{"test":"test"},"dependencies":{"async":"^1.4.2"},"devDependencies":{"tap":"~0.4.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/kesla/async-replace.git"},"keywords":["string","async","replace"],"author":{"name":"David Björklund","email":"david.bjorklund@gmail.com"},"license":"MIT","gitHead":"563bde50cc233ae6a77e570ca64a9e1b56dd373a","bugs":{"url":"https://github.com/kesla/async-replace/issues"},"homepage":"https://github.com/kesla/async-replace#readme","_id":"async-replace@1.0.1","_shasum":"d3f0857ccd02f1e94eb149cb5f89d58ac4f021d6","_from":".","_npmVersion":"3.3.9","_nodeVersion":"4.2.1","_npmUser":{"name":"kesla","email":"david.bjorklund@gmail.com"},"dist":{"shasum":"d3f0857ccd02f1e94eb149cb5f89d58ac4f021d6","size":2324,"noattachment":false,"key":"/async-replace/-/async-replace-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-replace/download/async-replace-1.0.1.tgz"},"maintainers":[{"name":"kesla","email":""}],"publish_time":1446874278271,"_cnpm_publish_time":1446874278271,"_hasShrinkwrap":false},"1.0.0":{"name":"async-replace","version":"1.0.0","description":"Run replace on a string and update it asynchronous","main":"async-replace.js","directories":{"test":"test"},"dependencies":{"async":"~0.1.22"},"devDependencies":{"tap":"~0.4.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/kesla/async-replace.git"},"keywords":["string","async","replace"],"author":{"name":"David Björklund","email":"david.bjorklund@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/kesla/async-replace/issues"},"homepage":"https://github.com/kesla/async-replace","_id":"async-replace@1.0.0","_shasum":"7fe65707ad431673b5a916fa7d1317f1ff223c65","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"kesla","email":"david.bjorklund@gmail.com"},"maintainers":[{"name":"kesla","email":""}],"dist":{"shasum":"7fe65707ad431673b5a916fa7d1317f1ff223c65","size":2342,"noattachment":false,"key":"/async-replace/-/async-replace-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-replace/download/async-replace-1.0.0.tgz"},"publish_time":1401742741973,"_cnpm_publish_time":1401742741973,"_hasShrinkwrap":false},"0.0.2":{"name":"async-replace","version":"0.0.2","description":"Run replace on a string and update it asynchronous","main":"async-replace.js","directories":{"test":"test"},"dependencies":{"async":"~0.1.22"},"devDependencies":{"tap":"~0.4.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/kesla/async-replace.git"},"keywords":["string","async","replace"],"author":{"name":"David Björklund","email":"david.bjorklund@gmail.com"},"license":"MIT","readmeFilename":"README.md","bugs":{"url":"https://github.com/kesla/async-replace/issues"},"_id":"async-replace@0.0.2","dist":{"shasum":"02102369c36a19c282b9f2e7f4078c9af98c774c","size":2113,"noattachment":false,"key":"/async-replace/-/async-replace-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-replace/download/async-replace-0.0.2.tgz"},"_from":".","_npmVersion":"1.2.23","_npmUser":{"name":"kesla","email":"david.bjorklund@gmail.com"},"maintainers":[{"name":"kesla","email":""}],"publish_time":1369605036921,"_hasShrinkwrap":false,"_cnpm_publish_time":1369605036921},"0.0.1":{"name":"async-replace","version":"0.0.1","description":"Run replace on a string and update it asynchronous","main":"async-replace.js","directories":{"test":"test"},"dependencies":{"async":"~0.1.22"},"devDependencies":{"tap":"~0.4.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/kesla/async-replace.git"},"keywords":["string","async","replace"],"author":{"name":"David Björklund","email":"david.bjorklund@gmail.com"},"license":"MIT","readmeFilename":"README.md","_id":"async-replace@0.0.1","dist":{"shasum":"521ab5533e6f320f9bb0756a9090ab96d6d83919","size":2060,"noattachment":false,"key":"/async-replace/-/async-replace-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-replace/download/async-replace-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"kesla","email":"david.bjorklund@gmail.com"},"maintainers":[{"name":"kesla","email":""}],"publish_time":1361380882471,"_hasShrinkwrap":false,"_cnpm_publish_time":1361380882471}},"readme":"#async-replace[![build status](https://secure.travis-ci.org/kesla/async-replace.png)](http://travis-ci.org/kesla/async-replace)\n\nRun replace on a string and update it asynchronous.\n\n## usage\n\nasync-replace have the same api as the callback-version of `String.prototype.replace` but instead of returning the changed data another callback is called, making it possible to do asynchronous stuff in the callback.\n\nThis may sound more complicated than it is, so let's look at an example.\n\n```js\nfunction replacer(match, p1, p2, p3, offset, string){\n    // p1 is nondigits, p2 digits, and p3 non-alphanumerics\n    return [p1, p2, p3].join(' - ');\n};\nnewString = \"abc12345#$*%\".replace(/([^\\d]*)(\\d*)([^\\w]*)/, replacer);\n```\n\nAbove is an example of using `String.prototype.replace` with a callback. The above could then be written in async-replace like this\n\n```js\nfunction replacer(match, p1, p2, p3, offset, string, done){\n    // p1 is nondigits, p2 digits, and p3 non-alphanumerics\n    setTimeout(function() {\n        done(null, [p1, p2, p3].join(' - '));\n    }, 100);\n};\nasyncReplace(\"abc12345#$*%\", /([^\\d]*)(\\d*)([^\\w]*)/, replacer, function(err, result) {\n    console.log(result); // will print 'abc - 12345 - #$*%';\n});\n```","_attachments":{},"homepage":"https://github.com/kesla/async-replace#readme","bugs":{"url":"https://github.com/kesla/async-replace/issues"},"license":"MIT"}