Skip to content

Commit a7d4bce

Browse files
committed
refactor(option): consistent variable naming in implementation
1 parent 8014b43 commit a7d4bce

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

src/Core__Option.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ function forEach(opt, f) {
3030

3131
}
3232

33-
function getExn(x) {
34-
if (x !== undefined) {
35-
return Caml_option.valFromOption(x);
33+
function getExn(opt) {
34+
if (opt !== undefined) {
35+
return Caml_option.valFromOption(opt);
3636
}
3737
throw {
3838
RE_EXN_ID: "Not_found",
@@ -92,12 +92,12 @@ function orElse(opt, other) {
9292
}
9393
}
9494

95-
function isSome(x) {
96-
return x !== undefined;
95+
function isSome(opt) {
96+
return opt !== undefined;
9797
}
9898

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

103103
function eq(a, b, f) {

src/Core__Option.res

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@ let flat = opt =>
3232

3333
let filterU = (opt, p) =>
3434
switch opt {
35-
| Some(x) as some if p(. x) => some
35+
| Some(value) as some if p(. value) => some
3636
| _ => None
3737
}
3838

39-
let filter = (opt, p) => filterU(opt, (. x) => p(x))
39+
let filter = (opt, p) => filterU(opt, (. value) => p(value))
4040

4141
let forEachU = (opt, f) =>
4242
switch opt {
43-
| Some(x) => f(. x)
43+
| Some(value) => f(. value)
4444
| None => ()
4545
}
4646

47-
let forEach = (opt, f) => forEachU(opt, (. x) => f(x))
47+
let forEach = (opt, f) => forEachU(opt, (. value) => f(value))
4848

49-
let getExn = x =>
50-
switch x {
51-
| Some(x) => x
49+
let getExn = opt =>
50+
switch opt {
51+
| Some(value) => value
5252
| None => raise(Not_found)
5353
}
5454

@@ -62,31 +62,31 @@ external getUnsafe: option<'a> => 'a = "%identity"
6262

6363
let mapWithDefaultU = (opt, default, f) =>
6464
switch opt {
65-
| Some(x) => f(. x)
65+
| Some(value) => f(. value)
6666
| None => default
6767
}
6868

69-
let mapWithDefault = (opt, default, f) => mapWithDefaultU(opt, default, (. x) => f(x))
69+
let mapWithDefault = (opt, default, f) => mapWithDefaultU(opt, default, (. value) => f(value))
7070

7171
let mapU = (opt, f) =>
7272
switch opt {
73-
| Some(x) => Some(f(. x))
73+
| Some(value) => Some(f(. value))
7474
| None => None
7575
}
7676

77-
let map = (opt, f) => mapU(opt, (. x) => f(x))
77+
let map = (opt, f) => mapU(opt, (. value) => f(value))
7878

7979
let flatMapU = (opt, f) =>
8080
switch opt {
81-
| Some(x) => f(. x)
81+
| Some(value) => f(. value)
8282
| None => None
8383
}
8484

85-
let flatMap = (opt, f) => flatMapU(opt, (. x) => f(x))
85+
let flatMap = (opt, f) => flatMapU(opt, (. value) => f(value))
8686

8787
let getWithDefault = (opt, default) =>
8888
switch opt {
89-
| Some(x) => x
89+
| Some(value) => value
9090
| None => default
9191
}
9292

@@ -96,13 +96,13 @@ let orElse = (opt, other) =>
9696
| None => other
9797
}
9898

99-
let isSome = x =>
100-
switch x {
99+
let isSome = opt =>
100+
switch opt {
101101
| Some(_) => true
102102
| None => false
103103
}
104104

105-
let isNone = x => x == None
105+
let isNone = value => value == None
106106

107107
let eqU = (a, b, f) =>
108108
switch a {

0 commit comments

Comments
 (0)