From 84fe7c235c7c3e366a7976b712de08826a3c67e1 Mon Sep 17 00:00:00 2001 From: Stephan Schneider Date: Sat, 2 Apr 2016 01:54:42 +0200 Subject: [PATCH] chore(gitignore): remove dist files from repo Dist files are only needed for pushing to npm. In order to keep commit diffs as small as possible remove dist/index.js and add dist to gitignore. --- .gitignore | 1 + .npmignore | 0 dist/index.js | 57 --------------------------------------------------- 3 files changed, 1 insertion(+), 57 deletions(-) create mode 100644 .npmignore delete mode 100644 dist/index.js diff --git a/.gitignore b/.gitignore index fd4f2b0..da592f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules .DS_Store +dist diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..e69de29 diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 5461f89..0000000 --- a/dist/index.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = createSocketIoMiddleware; - -/** -* Allows you to register actions that when dispatched, send the action to the -* server via a socket.io socket. -* `option` may be an array of action types, a test function, or a string prefix. -*/ -function createSocketIoMiddleware(socket) { - var option = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; - - var _ref = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; - - var _ref$eventName = _ref.eventName; - var eventName = _ref$eventName === undefined ? 'action' : _ref$eventName; - - return function (_ref2) { - var dispatch = _ref2.dispatch; - - // Wire socket.io to dispatch actions sent by the server. - socket.on(eventName, dispatch); - - return function (next) { - return function (action) { - var type = action.type; - - - if (type) { - var emit = false; - - if (typeof option === 'string') { - // String prefix - emit = type.indexOf(option) === 0; - } else if (typeof option === 'function') { - // Test function - emit = option(type, action); - } else if (Array.isArray(option)) { - // Array of types - emit = option.some(function (item) { - return type.indexOf(item) === 0; - }); - } - - if (emit) { - socket.emit(eventName, action); - } - } - - return next(action); - }; - }; - }; -} \ No newline at end of file