js代码扫描“refactor this function to reduce its cognitive complexity from 44 to the 15 allowed”,这个该怎么修复

NoSuchKey