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

gulp-mixpanel

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-mixpanel - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

13

index.js

@@ -16,9 +16,16 @@ var through = require('through2');

var stream = through.obj(function (file, enc, cb) {
var
script = config.template.replace(config.key, mixpanelToken),
content = undefined
;
if (file.isBuffer()) {
this.emit('error', new PluginError(PLUGIN_NAME, 'Buffers not supported!'));
return cb();
content = file.contents.toString('utf8');
content = content.replace('</body>', script + '</body>');
file.contents = new Buffer(content);
}
if (file.isStream()) {
file.contents = file.contents.pipe(rs('</body>', config.template.replace(config.key, mixpanelToken) + '</body>'));
file.contents = file.contents.pipe(rs('</body>', script + '</body>'));
}

@@ -25,0 +32,0 @@

{
"name": "gulp-mixpanel",
"version": "0.1.0",
"version": "0.2.0",
"description": "Adds mixpanel analytics into your html file",

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

@@ -9,6 +9,6 @@ var assert = require('assert');

describe('gulp-mixpanel', function () {
describe('in streaming mode', function () {
it('should prepend mixpanel script', function (done) {
it('should prepend mixpanel script', function (done) {
var token = "MY_TOKEN";

@@ -19,6 +19,6 @@ var html = new File({

});
var mixpanel = plugin(token);
mixpanel.write(html);
mixpanel.once('data', function (file) {

@@ -32,5 +32,26 @@ assert(file.isStream());

});
});
describe('in buffer mode', function () {
it('should prepend mixpanel script', function (done) {
var token = "MY_TOKEN";
var html = new File({
cwd: '/',
contents: new Buffer("<html><head></head><body></body></html>")
});
var mixpanel = plugin(token);
mixpanel.write(html);
mixpanel.once('data', function (file) {
assert(file.isBuffer());
assert.equal(file.contents.toString('utf8'), '<html><head></head><body>' + config.template.replace(config.key, token) + '</body></html>');
done();
});
});
});
});
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