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

redux-beacon

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-beacon - npm Package Compare versions

Comparing version 2.0.0-rc.1 to 2.0.0-rc.2

2

dist/get-events-with-matching-key.js

@@ -5,5 +5,5 @@ "use strict";

return Object.keys(eventsMap)
.filter(function (key) { return RegExp(key).test(actionType); })
.filter(function (key) { return key === '*' || key === actionType; })
.map(function (matchingKey) { return eventsMap[matchingKey]; });
}
exports.default = getEventsWithMatchingKey;
{
"name": "redux-beacon",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"description": "Analytics integration for Redux and ngrx/store",

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

@@ -25,5 +25,5 @@ import getEventsWithMatchingKey from '../get-events-with-matching-key';

{
title: 'action type matches a key pattern',
title: 'action type matches "*"',
eventsMap: {
'@@ROUTER@@': 'eventDefRouter',
'*': 'eventDefAll',
ACTION_TYPE_A: 'eventDefAA',

@@ -33,8 +33,8 @@ ACTION_TYPE_B: 'eventDefB',

actionType: '@@ROUTER@@/some/path',
expected: ['eventDefRouter'],
expected: ['eventDefAll'],
},
{
title: 'action type matches a key pattern and has exact match',
title: 'action type matches "*" and a key',
eventsMap: {
ACTION_TYPE_A: 'eventDefA',
'*': 'eventDefAll',
ACTION_TYPE_AA: 'eventDefAA',

@@ -44,44 +44,12 @@ ACTION_TYPE_BB: 'eventDefBB',

actionType: 'ACTION_TYPE_AA',
expected: ['eventDefA', 'eventDefAA'],
expected: ['eventDefAll', 'eventDefAA'],
},
{
title: 'action type matches multiple key patterns',
title: 'action type has square braces',
eventsMap: {
ACTION_TYPE: 'eventDefX',
ACTION_TYPE_A: 'eventDefA',
ACTION_TYPE_B: 'eventDefB',
'[Collection] Add Book Success': 'eventDefAddBookSuccess',
},
actionType: 'ACTION_TYPE_AA',
expected: ['eventDefX', 'eventDefA'],
actionType: '[Collection] Add Book Success',
expected: ['eventDefAddBookSuccess'],
},
{
title: 'action type matches .* pattern',
eventsMap: {
'.*': 'eventDefAll',
ACTION_TYPE_A: 'eventDefA',
ACTION_TYPE_B: 'eventDefB',
},
actionType: 'ANY_ACTION_TYPE',
expected: ['eventDefAll'],
},
{
title: 'action type matches .* pattern and key pattern',
eventsMap: {
'.*': 'eventDefAll',
ACTION_TYPE: 'eventDefAny',
ACTION_TYPE_B: 'eventDefB',
},
actionType: 'ACTION_TYPE_Z',
expected: ['eventDefAll', 'eventDefAny'],
},
{
title: 'action type matches .* pattern and has exact match',
eventsMap: {
'.*': 'eventDefAll',
ACTION_TYPE_Z: 'eventDefZ',
ACTION_TYPE_B: 'eventDefB',
},
actionType: 'ACTION_TYPE_Z',
expected: ['eventDefAll', 'eventDefZ'],
},
].forEach((scenario, index) => {

@@ -88,0 +56,0 @@ const { title, eventsMap, actionType, expected, only } = scenario;

@@ -8,3 +8,3 @@ import { EventDefinition, EventsMap } from './types';

return Object.keys(eventsMap)
.filter(key => RegExp(key).test(actionType))
.filter(key => key === '*' || key === actionType)
.map(matchingKey => eventsMap[matchingKey]);

@@ -11,0 +11,0 @@ }

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