Skip to content

Commit 94a5fd6

Browse files
authored
Merge pull request #16 from bromne/develop
v2.0.0
2 parents afe944a + 4351102 commit 94a5fd6

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ npm install --save typescript-optional
3333

3434
```ts
3535
// import Optional type from this module
36-
import Optional from 'typescript-optional';
36+
import { Optional } from "typescript-optional";
3737
```
3838

3939
### creating `Optional<T>` objects

src/optional.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,21 @@ describe("Optional", () => {
8585

8686
describe("#isPresent", () => {
8787
it("should return true if it is present", () => {
88-
assert.strictEqual(sutPresent.isPresent, true);
88+
assert.strictEqual(sutPresent.isPresent(), true);
8989
});
9090

9191
it("should return false if it is not present", () => {
92-
assert.strictEqual(sutEmpty.isPresent, false);
92+
assert.strictEqual(sutEmpty.isPresent(), false);
9393
});
9494
});
9595

9696
describe("#isEmpty", () => {
9797
it("should return false if it is present", () => {
98-
assert.strictEqual(sutPresent.isEmpty, false);
98+
assert.strictEqual(sutPresent.isEmpty(), false);
9999
});
100100

101101
it("should return true if it is not present", () => {
102-
assert.strictEqual(sutEmpty.isEmpty, true);
102+
assert.strictEqual(sutEmpty.isEmpty(), true);
103103
});
104104
});
105105

src/optional.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ import { Cases, Option } from "./types";
1818
*/
1919
export abstract class Optional<T> {
2020
/**
21-
* Represents whether this is present or not.
21+
* Returns whether this is present or not.
2222
*
2323
* If a payload is present, be `true` , otherwise be `false`.
2424
*/
25-
abstract get isPresent(): boolean;
25+
abstract isPresent(): boolean;
2626

2727
/**
28-
* Represents whether this is empty or not.
28+
* Returns whether this is empty or not.
2929
*
3030
* If this is empty, be `true`, otherwise be `false`.
31-
* This method is negation of `Optional.isPresent`.
31+
* This method is negation of `Optional#isPresent`.
3232
*/
33-
get isEmpty(): boolean {
34-
return !this.isPresent;
33+
isEmpty(): boolean {
34+
return !this.isPresent();
3535
}
3636

3737
/**
@@ -219,7 +219,7 @@ export abstract class Optional<T> {
219219
class PresentOptional<T> extends Optional<T> {
220220
payload: T;
221221

222-
get isPresent(): boolean {
222+
isPresent(): boolean {
223223
return true;
224224
}
225225

@@ -291,7 +291,7 @@ class PresentOptional<T> extends Optional<T> {
291291
}
292292

293293
class EmptyOptional<T> extends Optional<T> {
294-
get isPresent(): boolean {
294+
isPresent(): boolean {
295295
return false;
296296
}
297297

0 commit comments

Comments
 (0)