Example Code is out of order in Chapter 2
bnchrch opened this issue · comments
Summary
First of all thanks so much for putting together this resource.
One thing I noticed is that the first code example in Chapter 2 under `Adding Data:
+ async addNewPiece(hash, instrument = 'Piano') {
+ const existingPiece = this.getPieceByHash(hash)
+ if (existingPiece) {
+ await this.updatePieceByHash(hash, instrument)
+ return
+ }
+
+ const cid = await this.pieces.put({ hash, instrument })
+ return cid
+ }
uses two functions getPieceByHash
updatePieceByHash
which aren't defined until much much later. This could be normal however it goes on to having you run the incomplete code.
Thanks for this @bechurch. I'll take a look and fix up the text.
You rock! Thanks @aphelionz
@bechurch sorry this took me so long, but I made a PR. Can you review?