Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created July 27, 2019 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongorman/69104e880e9d7fd0995e88362785035b to your computer and use it in GitHub Desktop.
Save jasongorman/69104e880e9d7fd0995e88362785035b to your computer and use it in GitHub Desktop.
class Warehouse {
constructor(catalogue) {
this.catalogue = catalogue;
}
receive(batch) {
const received = batch.cds[0];
let cd = this.catalogue.search(received.title, received.artist);
if (cd == null) {
cd = this.catalogue.add(received);
}
cd.addStock(received.copies);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment