Use JavaScript Optional chaining in vendors/*

This commit is contained in:
the-djmaze 2022-09-12 22:07:51 +02:00
parent e5e4675c1b
commit ef8b1f40e4
28 changed files with 619 additions and 750 deletions

View file

@ -14,11 +14,9 @@ ko.observable = initialValue => {
}
return this; // Permits chained assignments
}
else {
// Read
ko.dependencyDetection.registerDependency(observable); // The caller only needs to be notified of changes if they did a "read" operation
return observable[observableLatestValue];
}
// Read
ko.dependencyDetection.registerDependency(observable); // The caller only needs to be notified of changes if they did a "read" operation
return observable[observableLatestValue];
}
observable[observableLatestValue] = initialValue;
@ -40,7 +38,7 @@ ko.observable = initialValue => {
var observableFn = {
'toJSON': function() {
let value = this[observableLatestValue];
return value && value.toJSON ? value.toJSON() : value;
return value?.toJSON?.() || value;
},
equalityComparer: valuesArePrimitiveAndEqual,
peek: function() { return this[observableLatestValue]; },