空手道0.9.5版中Object.keys和hsOwnProperty js函数不起作用 [英] Object.keys and hsOwnProperty js functions are not working in Karate version 0.9.5
问题描述
以前,我使用的是空手道版本0.8.0.迁移到0.9.5后,我在使用Object.keys
和hasOwnProperty
的所有函数开始出现错误TypeError: available.hasOwnProperty is not a function
.
Previously i was using karate version 0.8.0. After migrating to 0.9.5 all of my functions where i am using Object.keys
and hasOwnProperty
starts giving me error TypeError: available.hasOwnProperty is not a function
.
在上面的代码available = {
"123": {
"57": 2
}
}
In above code available = {
"123": {
"57": 2
}
}
推荐答案
是的,不支持这些规则,作为一般规则-仅将JS用于逻辑,我们甚至不建议将JS用于循环:
Yes these are not supported, as a general rule - use JS only for logic, we don't even advise using JS for loops: https://github.com/intuit/karate#loops
请改用 karate.keysOf()
,并且还有更多类似的API -s用于其他情况.
Please use the karate.keysOf()
instead, and there are many more similar API-s for other cases.
这篇关于空手道0.9.5版中Object.keys和hsOwnProperty js函数不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!