@@ -83,23 +83,23 @@ let asNullable = optString->Nullable.fromOption // Nullable.t<string>
8383let fromOption : option <'a > => t <'a >
8484
8585/**
86- `getWithDefault (value, default)` returns `value` if not `null` or `undefined`,
86+ `getOr (value, default)` returns `value` if not `null` or `undefined`,
8787otherwise return `default`.
8888
8989## Examples
9090
9191```rescript
92- Nullable.getWithDefault (Nullable.null, "Banana") // Banana
93- Nullable.getWithDefault (Nulalble.make("Apple"), "Banana") // Apple
92+ Nullable.getOr (Nullable.null, "Banana") // Banana
93+ Nullable.getOr (Nulalble.make("Apple"), "Banana") // Apple
9494
9595let greet = (firstName: option<string>) =>
96- "Greetings " ++ firstName->Nullable.getWithDefault ("Anonymous")
96+ "Greetings " ++ firstName->Nullable.getOr ("Anonymous")
9797
9898Nullable.make("Jane")->greet // "Greetings Jane"
9999Nullable.null->greet // "Greetings Anonymous"
100100```
101101*/
102- let getWithDefault : (t <'a >, 'a ) => 'a
102+ let getOr : (t <'a >, 'a ) => 'a
103103
104104/**
105105`getExn(value)` raises an exception if `null` or `undefined`, otherwise returns the value.
@@ -145,20 +145,20 @@ Nullable.map(undefined, x => x * x) // undefined
145145let map : (t <'a >, 'a => 'b ) => t <'b >
146146
147147/**
148- `mapWithDefault (value, default, f)` returns `f(value)` if `value` is not `null`
148+ `mapOr (value, default, f)` returns `f(value)` if `value` is not `null`
149149or `undefined`, otherwise returns `default`.
150150
151151## Examples
152152
153153```rescript
154154let someValue = Nullable.make(3)
155- someValue->Nullable.mapWithDefault (0, x => x + 5) // 8
155+ someValue->Nullable.mapOr (0, x => x + 5) // 8
156156
157157let noneValue = Nullable.null
158- noneValue->Nullable.mapWithDefault (0, x => x + 5) // 0
158+ noneValue->Nullable.mapOr (0, x => x + 5) // 0
159159```
160160*/
161- let mapWithDefault : (t <'a >, 'b , 'a => 'b ) => 'b
161+ let mapOr : (t <'a >, 'b , 'a => 'b ) => 'b
162162
163163/**
164164`flatMap(value, f)` returns `f(value)` if `value` is not `null` or `undefined`,
0 commit comments