From 34561d8d03f67d1689ec9a13dc31b43a1076906b Mon Sep 17 00:00:00 2001 From: Sergey Stotskiy Date: Mon, 20 Nov 2017 14:06:35 +0200 Subject: [PATCH] fix(observer): lowercased event name before translation Fixes #99 --- src/Observer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Observer.js b/src/Observer.js index e1afdcc..f6be963 100755 --- a/src/Observer.js +++ b/src/Observer.js @@ -52,9 +52,9 @@ export default class{ if(!action.startsWith('socket_')) continue - let camelcased = 'socket_'+event + let camelcased = 'socket_'+event.toLowerCase() .replace('SOCKET_', '') - .replace(/^([A-Z])|[\W\s_]+(\w)/g, (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()) + .replace(/[\W\s_]+(\w)/g, (match, p1) => p1.toUpperCase()) if(action === camelcased) this.store.dispatch(namespaced, payload) }