KnockoutJS primitiveTypes can just be checked with Object()

This commit is contained in:
the-djmaze 2024-03-03 22:47:19 +01:00
parent 0e1a34f067
commit 9db2690710

View file

@ -10,9 +10,8 @@ ko['extenders'] = {
}
};
var primitiveTypes = { 'undefined':1, 'boolean':1, 'number':1, 'string':1 };
function valuesArePrimitiveAndEqual(a, b) {
return (a === null || primitiveTypes[typeof(a)]) ? (a === b) : false;
return a !== Object(a) && a === b;
}
function throttle(callback, timeout) {