diff --git a/src/api/walk.js b/src/api/walk.js
index <HASH>..<HASH> 100644
--- a/src/api/walk.js
+++ b/src/api/walk.js
@@ -177,12 +177,14 @@ import { join } from '../utils/join.js'
  *
  * Example 2: Return the difference between the working directory and the HEAD commit
  * ```js
- * const diff = require('diff-lines')
- * async function map(filepath, [head, workdir]) {
+ * const map = async (filepath, [head, workdir]) => {
  *   return {
  *     filepath,
- *     oid: await head.oid(),
- *     diff: diff((await head.content()).toString('utf8'), (await workdir.content()).toString('utf8'))
+ *     oid: await head?.oid(),
+ *     diff: diff(
+ *       (await head?.content())?.toString('utf8') || '',
+ *       (await workdir?.content())?.toString('utf8') || ''
+ *     )
  *   }
  * }
  * ```
Handle edge cases in walk diff example (#<I>)

* Handle edge cases in walk diff example



* Update walk.js



Remove irrelevant code