Skip to content

Commit 33ecdc5

Browse files
committed
refactor(option): simplify implementation of isSome
1 parent b3195a3 commit 33ecdc5

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

Diff for: src/Core__Option.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ function isSome(opt) {
9696
return opt !== undefined;
9797
}
9898

99-
function isNone(value) {
100-
return value === undefined;
99+
function isNone(opt) {
100+
return opt === undefined;
101101
}
102102

103103
function eq(a, b, f) {

Diff for: src/Core__Option.res

+3-6
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,11 @@ let or = (opt, other) =>
9696
| None => other
9797
}
9898

99-
let isSome = opt =>
100-
switch opt {
101-
| Some(_) => true
102-
| None => false
103-
}
10499
let orElse = or
105100

106-
let isNone = value => value == None
101+
let isSome = opt => opt !== None
102+
103+
let isNone = opt => opt == None
107104

108105
let eqU = (a, b, f) =>
109106
switch a {

0 commit comments

Comments
 (0)