diff --git a/source/coreml.js b/source/coreml.js index 04db5a62be..711318c4b3 100644 --- a/source/coreml.js +++ b/source/coreml.js @@ -11,22 +11,13 @@ coreml.ModelFactory = class { const extension = identifier.split('.').pop().toLowerCase(); const tags = context.tags('pb'); if (tags.get(1) === 0 && tags.get(2) === 2) { - if (extension === 'pb') { - const tags = context.tags('pb+'); - const keys = Object.keys(tags).map((key) => parseInt(key, 10)); - const match = (key) => - (key >= 200 && key < 220) || - (key >= 300 && key < 320) || - (key >= 400 && key < 420) || - (key >= 500 && key < 520) || - (key >= 550 && key < 560) || - (key >= 600 && key < 620) || - (key === 900) || - (key >= 2000 && key < 2010) || - (key === 3000); - if (!keys.some((key) => match(key))) { - return; - } + const match = (key) => + (key >= 200 && key < 220) || (key >= 300 && key < 320) || (key >= 400 && key < 420) || + (key >= 500 && key < 520) || (key >= 550 && key < 560) || (key >= 600 && key < 620) || + (key === 900) || + (key >= 2000 && key < 2010) || (key === 3000); + if (extension === 'pb' && Array.from(tags.keys()).every((key) => !match(key))) { + return; } context.type = 'coreml.pb'; return;