Remove extra conditional

This commit is contained in:
Matt Bierner 2019-07-15 14:59:43 -07:00
parent 47e54aef5d
commit e5e29375f0

View file

@ -109,22 +109,20 @@ class EditorRegistry implements IEditorRegistry {
const matchingDescriptors: EditorDescriptor[] = [];
for (const editor of this.editors) {
const inputDescriptors = this.mapEditorToInputs.get(editor);
if (inputDescriptors) {
for (const inputDescriptor of inputDescriptors) {
const inputClass = inputDescriptor.ctor;
const inputDescriptors = this.mapEditorToInputs.get(editor) || [];
for (const inputDescriptor of inputDescriptors) {
const inputClass = inputDescriptor.ctor;
// Direct check on constructor type (ignores prototype chain)
if (!byInstanceOf && input.constructor === inputClass) {
matchingDescriptors.push(editor);
break;
}
// Direct check on constructor type (ignores prototype chain)
if (!byInstanceOf && input.constructor === inputClass) {
matchingDescriptors.push(editor);
break;
}
// Normal instanceof check
else if (byInstanceOf && input instanceof inputClass) {
matchingDescriptors.push(editor);
break;
}
// Normal instanceof check
else if (byInstanceOf && input instanceof inputClass) {
matchingDescriptors.push(editor);
break;
}
}
}