UNPKG

@atlaskit/analytics-next

Version:

React components, HOCs and hooks to assist with tracking user activity with React components

17 lines 430 B
var ENDS_WITH_DOT = /\.$/; function matchEvent(matcher, name) { if (matcher === '*' || name === undefined) { return true; } if (typeof matcher === 'string') { if (ENDS_WITH_DOT.test(matcher)) { return name.substr(0, matcher.length) === matcher; } return name === matcher; } if (typeof matcher === 'function') { return matcher(name); } return matcher.test(name); } export default matchEvent;