Skip to content

Commit de8a86f

Browse files
committed
refactor(option): simplify implementation of isSome
1 parent be9897e commit de8a86f

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/Core__Option.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ function isSome(opt) {
9292
return opt !== undefined;
9393
}
9494

95-
function isNone(value) {
96-
return value === undefined;
95+
function isNone(opt) {
96+
return opt === undefined;
9797
}
9898

9999
function eq(a, b, f) {

src/Core__Option.res

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

97-
let isSome = opt =>
98-
switch opt {
99-
| Some(_) => true
100-
| None => false
101-
}
10297
let orElse = or
10398

104-
let isNone = value => value == None
99+
let isSome = opt => opt !== None
100+
101+
let isNone = opt => opt == None
105102

106103
let eqU = (a, b, f) =>
107104
switch a {

0 commit comments

Comments
 (0)