New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S.equals不能处理function对比 #624
Comments
不能这么做,toString() 不可靠,不准确 function mix(){}.toString() !== function(){}.toString() |
对,不能让equals这么做。 |
动equals是不合理的,那么在compareObjects里做判别如何?对象的属性不会出现function mix(){}的情况吧。 |
不要搞两个的 function,用一个function两个引用 |
那怎么才能完美的做到把function也判别在内呢? |
S.equals({'h':{'h':'123',g:[123],t:function(){}}},{'h':{'h':'123',g:[123],t:function(){}}});
结果是false
可否在object判断之前加上
if (typeof a === 'function' && typeof b === 'function') {
return (a.toString() === b.toString());
}
这样就正常对比了。
The text was updated successfully, but these errors were encountered: