(
res, //需要添加值的对象
hash, // 属性对象
key, // 原始key
altKey, //转换后的 横杆key
preserve //是否要删除hash 对象中的属性或者方法 状态 布尔值
)
| 3242 | |
| 3243 | //检查 属性 检查key和altKey 在hash属性对象中有没有,如果有则赋值给res对象 |
| 3244 | function checkProp( |
| 3245 | res, //需要添加值的对象 |
| 3246 | hash, // 属性对象 |
| 3247 | key, // 原始key |
| 3248 | altKey, //转换后的 横杆key |
| 3249 | preserve //是否要删除hash 对象中的属性或者方法 状态 布尔值 |
| 3250 | ) { |
| 3251 | //hash 值存在 |
| 3252 | if (isDef(hash)) { |
| 3253 | //如果是hash对象中含有key 属性或者方法 |
| 3254 | if (hasOwn(hash, key)) { |
| 3255 | //添加res值 |
| 3256 | res[key] = hash[key]; |
| 3257 | //preserve 不存在的时候则在hash对象中删除该key 属性或者方法 |
| 3258 | if (!preserve) { |
| 3259 | delete hash[key]; |
| 3260 | } |
| 3261 | return true |
| 3262 | } else if (hasOwn(hash, altKey)) { //如果是hash对象中含有altKey 属性或者方法 |
| 3263 | //添加res值 |
| 3264 | res[key] = hash[altKey]; |
| 3265 | //preserve 不存在的时候则在hash对象中删除该key 属性或者方法 |
| 3266 | if (!preserve) { |
| 3267 | delete hash[altKey]; |
| 3268 | } |
| 3269 | return true |
| 3270 | } |
| 3271 | } |
| 3272 | return false |
| 3273 | } |
| 3274 | |
| 3275 | /* */ |
| 3276 |
no test coverage detected