Skip to content

Commit

Permalink
Fix Maybe<T>.
Browse files Browse the repository at this point in the history
  • Loading branch information
terurou committed Jan 17, 2019
1 parent 5f3d070 commit e75f566
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions haxelib.json
Expand Up @@ -4,9 +4,9 @@
"license": "Apache",
"tags": ["haxe", "extern", "type"],
"description": "Enhanced standard types for Haxe",
"version": "1.0.1",
"version": "1.0.2",
"classPath": "src/",
"releasenote": "Fix Tuple2-10.",
"releasenote": "Fix Maybe.",
"contributors": ["denkiyagi"],
"dependencies": {}
}
2 changes: 1 addition & 1 deletion src/extype/Maybe.hx
Expand Up @@ -11,7 +11,7 @@ abstract Maybe<T>(Null<T>) {
}

@:from
@:extern public static inline function from<T>(x: Null<T>): Maybe<T> {
@:extern public static inline function ofNullable<T>(x: Null<T>): Maybe<T> {
#if js
return new Maybe((x == null) ? null : x);
#else
Expand Down
8 changes: 4 additions & 4 deletions test/extype/MaybeSuite.hx
Expand Up @@ -44,14 +44,14 @@ class MaybeSuite extends BuddySuite {
});
});

describe("Maybe.from()", {
describe("Maybe.ofNullable()", {
it("can convert value", {
Maybe.from(1).get().should.be(1);
Maybe.ofNullable(1).get().should.be(1);
});
it("can convert null", {
Maybe.from(null).isEmpty().should.be(true);
Maybe.ofNullable(null).isEmpty().should.be(true);
#if js
Maybe.from(js.Lib.undefined).isEmpty().should.be(true);
Maybe.ofNullable(js.Lib.undefined).isEmpty().should.be(true);
#end
});
});
Expand Down

0 comments on commit e75f566

Please sign in to comment.