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

gulp-replace

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-replace - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

30

index.js

@@ -1,14 +0,15 @@

var es = require('event-stream');
'use strict';
var through = require('through2');
var rs = require('replacestream');
var stream = require('stream');
var istextorbinary = require('istextorbinary');
module.exports = function(search, replacement, options) {
var doReplace = function(file, callback) {
var isRegExp = search instanceof RegExp;
var isStream = file.contents && typeof file.contents.on === 'function' && typeof file.contents.pipe === 'function';
var isBuffer = file.contents instanceof Buffer;
var doReplace = function(file, enc, callback) {
if (file.isNull()) {
return callback(null, file);
}
function doReplace() {
if (isStream) {
if (file.isStream()) {
file.contents = file.contents.pipe(rs(search, replacement));

@@ -18,4 +19,4 @@ return callback(null, file);

if (isBuffer) {
if (isRegExp) {
if (file.isBuffer()) {
if (search instanceof RegExp) {
file.contents = new Buffer(String(file.contents).replace(search, replacement));

@@ -54,3 +55,2 @@ }

callback(null, file);
}

@@ -65,3 +65,3 @@

if (!result) {
return callback(null, file);
callback(null, file);
} else {

@@ -71,10 +71,10 @@ doReplace();

});
return;
}
else {
doReplace();
}
doReplace();
};
return es.map(doReplace);
return through.obj(doReplace);
};
{
"name": "gulp-replace",
"version": "0.5.2",
"version": "0.5.3",
"description": "A string replace plugin for gulp",
"main": "index.js",
"dependencies": {
"event-stream": "3.2.1",
"istextorbinary": "1.0.2",
"replacestream": "2.0.0",
"istextorbinary": "1.0.2"
"through2": "0.6.3"
},
"devDependencies": {
"should": "^4.6.0",
"event-stream": "^3.2.2",
"mocha": "^2.1.0",
"gulp-util": "^3.0.2"
"should": "^5.0.0",
"vinyl": "^0.4.6"
},
"scripts": {
"test": "./node_modules/.bin/mocha"
"test": "mocha"
},

@@ -19,0 +19,0 @@ "repository": {

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