redux-beacon
Advanced tools
Comparing version 2.0.0-rc.1 to 2.0.0-rc.2
@@ -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 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
41513
1215