Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion observers.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ exports.makeDefinedObserver = makeDefinedObserver;
function makeDefinedObserver(observeValue) {
return function observeDefault(emit, scope) {
return observeValue(autoCancelPrevious(function replaceValue(value) {
return emit(value != null);
return emit(Operators.defined(value));
}), scope);
};
}
Expand Down
4 changes: 3 additions & 1 deletion operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ exports.or = function (a, b) {
};

exports.defined = function (value) {
return value != null;
// value != null eliminates null and undefined
// value === value eliminates NaN
return value != null && value === value;
};

// "startsWith", "endsWith", and "contains" are overridden in
Expand Down