as-container
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -10,10 +10,10 @@ import { Box } from "../box"; | ||
class B extends A { | ||
b(): void { } | ||
@operator("==") | ||
eq(other: this): bool { | ||
return super.eq(other) && false; | ||
return false; | ||
} | ||
} | ||
class Person {} | ||
describe("Box", () => { | ||
@@ -24,4 +24,2 @@ it("from, new", () => { | ||
expect(box).toStrictEqual(box2); | ||
expect(new A() == new B()).toBe(true); | ||
expect(new B() == new B()).toBe(false); | ||
}); | ||
@@ -67,2 +65,8 @@ | ||
expect(Box.from(p1) != Box.from(p2)).toBe(true); | ||
expect(new A() == new B()).toBe(true); | ||
expect(new B() == new B()).toBe(false); | ||
expect(Box.from<A>(new A()) == Box.from<A>(new B())).toBe(true); | ||
expect(Box.from(new B()) == Box.from(new B())).toBe(false); | ||
expect(Box.from<A>(new B()) == Box.from<A>(new B())).toBe(false); | ||
}); | ||
@@ -348,2 +352,1 @@ | ||
class Person { } |
@@ -17,3 +17,3 @@ import { MapFn, RecoveryFn } from "../shared"; | ||
constructor( | ||
protected readonly _val: T = instantiateZero<T>(), | ||
protected _val: T = instantiateZero<T>(), | ||
protected _isNone: bool = true | ||
@@ -20,0 +20,0 @@ ) {} |
@@ -17,6 +17,6 @@ import { Option } from "./option"; | ||
export class Result<O, E> implements Resultable<O, E> { | ||
protected readonly _ok: O; | ||
protected readonly _err: E; | ||
protected _ok: O; | ||
protected _err: E; | ||
// Note: make _isOk in the last is good for layout when err size is less than ok size. | ||
protected readonly _isOk: bool; | ||
protected _isOk: bool; | ||
// @ts-ignore | ||
@@ -23,0 +23,0 @@ @unsafe |
@@ -13,3 +13,3 @@ import { Optionable } from "../optionable"; | ||
export class Option<T> implements Optionable<T> { | ||
constructor(protected readonly _val: T | null = null) {} | ||
constructor(protected _val: T | null = null) {} | ||
@@ -16,0 +16,0 @@ @inline |
@@ -18,5 +18,5 @@ import { Option } from "./option"; | ||
// _ok is null when _err is not null. | ||
protected readonly _ok: O | null, | ||
protected _ok: O | null, | ||
// _err is null when _ok is not null. | ||
protected readonly _err: E | null | ||
protected _err: E | null | ||
) {} | ||
@@ -23,0 +23,0 @@ |
@@ -0,1 +1,8 @@ | ||
## <small>0.6.1 (2021-08-20)</small> | ||
* feat: remove readonly for protect fields for option/result (#38) ([304d634](https://github.com/yjhmelody/as-container/commit/304d634)), closes [#38](https://github.com/yjhmelody/as-container/issues/38) | ||
* tests: fix box test (#37) ([775c6b0](https://github.com/yjhmelody/as-container/commit/775c6b0)), closes [#37](https://github.com/yjhmelody/as-container/issues/37) | ||
## 0.6.0 (2021-07-30) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "as-container", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "assemblyscript version of Rust Option<T> and Result<T, E> and Box<T> etc.", | ||
@@ -5,0 +5,0 @@ "author": "yjhmelody <yjh465402634@gmail.com>", |
84831
2041