Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

replacestream

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replacestream - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

.travis.yml

14

index.js

@@ -32,2 +32,3 @@ var through = require('through');

totalMatches++;
rewritten += before + replace;

@@ -41,4 +42,13 @@ tail = '';

if (matchCount) {
after = haystack.slice(lastPos, haystack.length - tail.length);
this.queue(rewritten + after);
after = haystack.slice(lastPos, haystack.length);
if(tail.length + after.length < search.length){
tail += after;
}
else{
rewritten += tail +after;
tail = '';
}
this.queue(rewritten);
} else if (tail) {

@@ -45,0 +55,0 @@ this.queue(haystack);

2

package.json
{
"name": "replacestream",
"version": "0.0.3",
"version": "0.0.4",
"description": "A node.js through stream that does basic streaming text search and replace and is chunk boundary friendly",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,2 +6,4 @@ # replacestream

[![build status](https://secure.travis-ci.org/eugeneware/replacestream.png)](http://travis-ci.org/eugeneware/replacestream)
## Installation

@@ -8,0 +10,0 @@

@@ -13,4 +13,30 @@ var expect = require('chai').expect

}
describe('replace', function () {
it('should only replace characters specified', function (done) {
var haystack = [
'ab',
'a',
'b'
].join('\n');
describe('replace', function () {
var acc = '';
var replace = replaceStream('ab','Z');
replace.on('data', function (data) {
acc += data;
});
replace.on('end', function () {
var expected = [
'Z',
'a',
'b'
].join('\n');
expect(acc).to.equal(expected);
done();
});
replace.write(haystack);
replace.end();
});
it('should be able to replace within a chunk', function (done) {

@@ -17,0 +43,0 @@ var haystack = [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc