Permalink
Browse files

lint exercises: bowling, change, circular-buffer (#538)

  • Loading branch information...
trvrfrd authored and tejasbubane committed Oct 29, 2018
1 parent c261c3f commit a56d10b20cb7f83e3ddd004f3aeb96b51473f443
Showing with 8 additions and 9 deletions.
  1. +0 −3 .eslintignore
  2. +1 −2 exercises/circular-buffer/circular-buffer.spec.js
  3. +7 −4 exercises/circular-buffer/example.js
@@ -1,8 +1,5 @@
allergies
alphametics
bowling
change
circular-buffer
clock
complex-numbers
connect
@@ -1,5 +1,4 @@
import circularBuffer from './circular-buffer';
import { BufferFullError, BufferEmptyError } from './circular-buffer';
import circularBuffer, { BufferFullError, BufferEmptyError } from './circular-buffer';
describe('CircularBuffer', () => {
test('reading an empty buffer throws a BufferEmptyError', () => {
@@ -1,5 +1,5 @@
let buffer,
bufferMax;
let buffer;
let bufferMax;
export class BufferEmptyError extends Error {
constructor(message) {
@@ -25,7 +25,7 @@ const write = (value) => {
if (buffer.length === bufferMax) {
throw new BufferFullError();
}
value ? buffer.push(value) : null;
return value ? buffer.push(value) : null;
};
const forceWrite = (value) => {
@@ -35,7 +35,10 @@ const forceWrite = (value) => {
write(value);
};
const clear = () => buffer = [];
const clear = () => {
buffer = [];
return buffer;
};
const CircularBuffer = (capacity) => {
buffer = [];

0 comments on commit a56d10b

Please sign in to comment.