Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/KeyboardsRegistry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {AppRegistry} from 'react-native';
import _ from 'lodash';
import EventEmitterManager from './utils/EventEmitterManager';
import {intersection} from './utils/utils';

/*
* Tech debt: how to deal with multiple registries in the app?
Expand All @@ -20,7 +20,7 @@ export default class KeyboardRegistry {
static eventEmitter = new EventEmitterManager();

static registerKeyboard = (componentID, generator, params = {}) => {
if (!_.isFunction(generator)) {
if (typeof generator !== 'function') {
console.error(`KeyboardRegistry.registerKeyboard: ${componentID} you must register a generator function`);//eslint-disable-line
return;
}
Expand All @@ -38,7 +38,7 @@ export default class KeyboardRegistry {
};

static getKeyboards = (componentIDs = []) => {
const validKeyboardIDs = _.intersection(componentIDs, Object.keys(KeyboardRegistry.registeredKeyboards));
const validKeyboardIDs = intersection(componentIDs, Object.keys(KeyboardRegistry.registeredKeyboards));
return getKeyboardsWithIDs(validKeyboardIDs);
};

Expand Down
4 changes: 1 addition & 3 deletions src/utils/EventEmitterManager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import _ from 'lodash';

export default class EventEmitterManager {
constructor() {
this.handlerCallbacks = {};
Expand All @@ -9,7 +7,7 @@ export default class EventEmitterManager {
if (!this.handlerCallbacks[eventName]) {
this.handlerCallbacks[eventName] = [];
}
if (_.indexOf(this.handlerCallbacks[eventName], handlerCallback) === -1) {
if (this.handlerCallbacks[eventName].indexOf(handlerCallback) === -1) {
this.handlerCallbacks[eventName].push(handlerCallback);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function intersection(first, second) {
return first.filter(element => second.indexOf(element) > -1);
}