How about `automaticallyEnabledExtensions.indexOf(extension.replace('_MOZ', '').replace('_WEBKIT', '')`?