orbitdb / field-manual

The Offical User's Guide to OrbitDB
207 stars 43 forks source link

Example Code is out of order in Chapter 2 #105

Closed bnchrch closed 4 years ago

bnchrch commented 4 years ago

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.

aphelionz commented 4 years ago

Thanks for this @bechurch. I'll take a look and fix up the text.

bnchrch commented 4 years ago

You rock! Thanks @aphelionz

aphelionz commented 4 years ago

@bechurch sorry this took me so long, but I made a PR. Can you review?