Skip to content

Commit 661f99e

Browse files
committed
Refactor addIgnoredModule function
1 parent 833a1f2 commit 661f99e

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

lib/NativeClient.js

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,17 @@ export class NativeClient {
107107
if (this._ignoredModules[moduleID]) {
108108
continue;
109109
}
110-
if (
111-
this.options.ignoreModulesExclude.indexOf(moduleName) === -1 &&
112-
(DEFAULT_MODULE_IGNORES.indexOf(moduleName) >= 0 ||
113-
this.options.ignoreModulesInclude.indexOf(moduleName) >= 0)
114-
) {
115-
this._ignoredModules[moduleID] = true;
116-
}
110+
this._addIgnoredModule(moduleID, moduleName);
111+
}
112+
}
113+
114+
_addIgnoredModule(moduleID, moduleName) {
115+
if (
116+
this.options.ignoreModulesExclude.indexOf(moduleName) === -1 &&
117+
(DEFAULT_MODULE_IGNORES.indexOf(moduleName) >= 0 ||
118+
this.options.ignoreModulesInclude.indexOf(moduleName) >= 0)
119+
) {
120+
this._ignoredModules[moduleID] = true;
117121
}
118122
}
119123

@@ -128,26 +132,15 @@ export class NativeClient {
128132
if (typeof __fbBatchedBridgeConfig !== 'undefined') {
129133
/* global __fbBatchedBridgeConfig */
130134
__fbBatchedBridgeConfig.remoteModuleConfig.forEach((module, moduleID) => {
131-
if (
132-
module !== null &&
133-
this.options.ignoreModulesExclude.indexOf(module[0]) === -1 &&
134-
(DEFAULT_MODULE_IGNORES.indexOf(module[0]) >= 0 ||
135-
this.options.ignoreModulesInclude.indexOf(module[0]) >= 0)
136-
) {
137-
this._ignoredModules[moduleID] = true;
135+
if (module !== null) {
136+
this._addIgnoredModule(moduleID, module[0]);
138137
}
139138
});
140139
} else if (BatchedBridge._remoteModuleTable) {
141-
for (let module in BatchedBridge._remoteModuleTable) {
142-
if (BatchedBridge._remoteModuleTable.hasOwnProperty(module)) {
143-
let moduleName = BatchedBridge._remoteModuleTable[module];
144-
if (
145-
this.options.ignoreModulesExclude.indexOf(moduleName) === -1 &&
146-
(DEFAULT_MODULE_IGNORES.indexOf(moduleName) >= 0 ||
147-
this.options.ignoreModulesInclude.indexOf(moduleName) >= 0)
148-
) {
149-
this._ignoredModules[module] = true;
150-
}
140+
for (let moduleID in BatchedBridge._remoteModuleTable) {
141+
if (BatchedBridge._remoteModuleTable.hasOwnProperty(moduleID)) {
142+
let moduleName = BatchedBridge._remoteModuleTable[moduleID];
143+
this._addIgnoredModule(moduleID, moduleName);
151144
}
152145
}
153146
}

0 commit comments

Comments
 (0)