Skip to content

Commit fa45dd9

Browse files
committed
Rename getOrElse -> getWithDefault, has -> isSome, isEmpty -> isNone
1 parent a77fcbb commit fa45dd9

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

jscomp/others/belt_Option.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ let flatMapU opt f = match opt with
4545

4646
let flatMap opt f = flatMapU opt (fun[@bs] x -> f x)
4747

48-
let getOrElse opt default = match opt with
48+
let getWithDefault opt default = match opt with
4949
| Some x -> x
5050
| None -> default
5151

52-
let has = function
52+
let isSome = function
5353
| Some _ -> true
5454
| None -> false
5555

56-
let isEmpty = function
56+
let isNone = function
5757
| Some _ -> false
5858
| None -> true

jscomp/others/belt_Option.mli

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ val mapU : 'a option -> ('a -> 'b [@bs]) -> 'b option
3434
val map : 'a option -> ('a -> 'b) -> 'b option
3535
val flatMapU : 'a option -> ('a -> 'b option [@bs]) -> 'b option
3636
val flatMap : 'a option -> ('a -> 'b option) -> 'b option
37-
val getOrElse : 'a option -> 'a -> 'a
38-
val has : 'a option -> bool
39-
val isEmpty : 'a option -> bool
37+
val getWithDefault : 'a option -> 'a -> 'a
38+
val isSome : 'a option -> bool
39+
val isNone : 'a option -> bool

lib/js/belt_Option.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,23 @@ function flatMap(opt, f) {
4646
return flatMapU(opt, Curry.__1(f));
4747
}
4848

49-
function getOrElse(opt, $$default) {
49+
function getWithDefault(opt, $$default) {
5050
if (opt) {
5151
return opt[0];
5252
} else {
5353
return $$default;
5454
}
5555
}
5656

57-
function has(param) {
57+
function isSome(param) {
5858
if (param) {
5959
return /* true */1;
6060
} else {
6161
return /* false */0;
6262
}
6363
}
6464

65-
function isEmpty(param) {
65+
function isNone(param) {
6666
if (param) {
6767
return /* false */0;
6868
} else {

0 commit comments

Comments
 (0)