Skip to content

Commit

Permalink
refactor(queue): remove size method on Queue
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Removed `Queue.size()` method. Use `Queue.length` instead.
  • Loading branch information
tusharmath committed Oct 17, 2019
1 parent 96cd3bc commit 48d45e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions src/main/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ export class Queue<A = never> {
return this.Q.asArray
}

public get length(): UIO<number> {
return this.Q.length
}

/**
* Returns the current size of the queue
* Returns the number of elements in the queue
*/
public get size(): UIO<number> {
public get length(): UIO<number> {
return this.Q.length
}

Expand Down
4 changes: 2 additions & 2 deletions test/Queue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Queue', () => {
describe('offer', () => {
it('should add the element to the queue', () => {
const actual = testRuntime().unsafeExecuteSync(
Queue.unbounded<number>().chain(Q => Q.offer(1000).and(Q.size))
Queue.unbounded<number>().chain(Q => Q.offer(1000).and(Q.length))
)
const expected = 1

Expand All @@ -32,7 +32,7 @@ describe('Queue', () => {
it('should add multiple elements to the queue', () => {
const actual = testRuntime().unsafeExecuteSync(
Queue.unbounded<number>().chain(Q =>
Q.offerAll(1, 2, 3, 4, 5).and(Q.size)
Q.offerAll(1, 2, 3, 4, 5).and(Q.length)
)
)
const expected = 5
Expand Down

0 comments on commit 48d45e5

Please sign in to comment.