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

@segment/analytics.js-core

Package Overview
Dependencies
Maintainers
153
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@segment/analytics.js-core - npm Package Compare versions

Comparing version 3.11.4 to 3.12.4

6

HISTORY.md

@@ -0,2 +1,7 @@

# 3.12.4 / 2020-04-23
- test: add add/apply middleware stress test
- update tests to not fail when adding middleware post-init
- rm checks to disallow adding middleware post-init
# v3.11.3 / 2020-04-13

@@ -7,2 +12,3 @@

# v3.11.0
- feat: use SameSite=Lax by default (#128)

@@ -9,0 +15,0 @@

10

lib/analytics.js

@@ -108,7 +108,2 @@ 'use strict';

Analytics.prototype.addSourceMiddleware = function(middleware) {
if (this.initialized)
throw new Error(
'attempted to add a source middleware after initialization'
);
this._sourceMiddlewares.add(middleware);

@@ -126,7 +121,2 @@ return this;

Analytics.prototype.addIntegrationMiddleware = function(middleware) {
if (this.initialized)
throw new Error(
'attempted to add an integration middleware after initialization'
);
this._integrationMiddlewares.add(middleware);

@@ -133,0 +123,0 @@ return this;

2

package.json
{
"name": "@segment/analytics.js-core",
"author": "Segment <friends@segment.com>",
"version": "3.11.4",
"version": "3.12.4",
"description": "The hassle-free way to integrate analytics into any web application.",

@@ -6,0 +6,0 @@ "keywords": [

@@ -348,2 +348,47 @@ 'use strict';

});
it('should be able to add and apply middleware interchangably', function() {
chain.add(function(chain) {
chain.payload.obj.test.push(1);
chain.next(chain.payload);
});
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) {
assert.deepEqual(payload.obj.test, [1]);
});
chain.add(function(chain) {
chain.payload.obj.test.push(2);
chain.next(chain.payload);
});
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) {
assert.deepEqual(payload.obj.test, [1, 2]);
});
chain.add(function(chain) {
chain.payload.obj.test.push(3);
chain.next(chain.payload);
});
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) {
assert.deepEqual(payload.obj.test, [1, 2, 3]);
});
chain.add(function(chain) {
chain.payload.obj.test.push(4);
chain.next(chain.payload);
});
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) {
assert.deepEqual(payload.obj.test, [1, 2, 3, 4]);
});
chain.add(function(chain) {
chain.payload.obj.test.push(5);
chain.next(chain.payload);
});
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) {
assert.deepEqual(payload.obj.test, [1, 2, 3, 4, 5]);
});
chain.add(function(chain) {
chain.payload.obj.test.push(6);
chain.next(chain.payload);
});
chain.applyMiddlewares({ test: [] }, 'Test', function(payload) {
assert.deepEqual(payload.obj.test, [1, 2, 3, 4, 5, 6]);
});
});
});

Sorry, the diff of this file is too big to display

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