diff --git a/lib/index.js b/lib/index.js index 42b9668..4fde4ae 100644 --- a/lib/index.js +++ b/lib/index.js @@ -30,7 +30,7 @@ const Obz = require('obz') * @param {{ db: PPPPPDB | null }} peer * @returns {asserts peer is { db: PPPPPDB }} */ -function assertDBExists(peer) { +function assertDBPlugin(peer) { if (!peer.db) throw new Error('goals plugin requires ppppp-db plugin') } @@ -38,7 +38,7 @@ function assertDBExists(peer) { * @param {{ record: PPPPPRecord | null }} peer * @returns {asserts peer is { record: PPPPPRecord }} */ -function assertRecordExists(peer) { +function assertRecordPlugin(peer) { if (!peer.record) throw new Error('goals plugin requires ppppp-record plugin') } @@ -115,7 +115,7 @@ class GoalImpl { * @param {unknown} config */ function initGoals(peer, config) { - assertDBExists(peer) + assertDBPlugin(peer) // Constants: const EMPTY_RANGE = /** @type {Range} */ ([1, 0]) @@ -138,7 +138,7 @@ function initGoals(peer, config) { case 'set': return [0, maxDepth] case 'record': - assertRecordExists(peer) + assertRecordPlugin(peer) const minDepth = peer.record.getMinRequiredDepth(goal.id) return [minDepth, maxDepth] case 'newest': @@ -174,7 +174,7 @@ function initGoals(peer, config) { * @returns {Purpose} */ function getRecordPurpose(rec) { - assertDBExists(peer) + assertDBPlugin(peer) let servesAsTrail = false // Check whether this record is a goalful root of some tangle: