mirror of https://codeberg.org/pzp/pzp-goals.git
restructure index.js for better exported types
This commit is contained in:
parent
037aec208c
commit
d8a0f841fe
|
@ -4,3 +4,4 @@ pnpm-lock.yaml
|
|||
package-lock.json
|
||||
coverage
|
||||
*~
|
||||
lib/*.d.ts
|
23
lib/index.js
23
lib/index.js
|
@ -26,9 +26,7 @@ const Obz = require('obz')
|
|||
*/
|
||||
|
||||
/**
|
||||
* @param {{
|
||||
* db: PPPPPDB | null,
|
||||
* }} peer
|
||||
* @param {{ db: PPPPPDB | null }} peer
|
||||
* @returns {asserts peer is { db: PPPPPDB }}
|
||||
*/
|
||||
function assertDBExists(peer) {
|
||||
|
@ -110,18 +108,11 @@ class GoalImpl {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'goals',
|
||||
manifest: {},
|
||||
permissions: {
|
||||
anonymous: {},
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {{ db: PPPPPDB | null, close: ClosableHook }} peer
|
||||
* @param {{ path: string; keypair: Keypair; }} config
|
||||
/**
|
||||
* @param {{ db: PPPPPDB | null }} peer
|
||||
* @param {unknown} config
|
||||
*/
|
||||
init(peer, config) {
|
||||
function initGoals(peer, config) {
|
||||
assertDBExists(peer)
|
||||
// Constants:
|
||||
const EMPTY_RANGE = /** @type {Range} */ ([1, 0])
|
||||
|
@ -246,5 +237,7 @@ module.exports = {
|
|||
list,
|
||||
listen,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
exports.name = 'goals'
|
||||
exports.init = initGoals
|
||||
|
|
Loading…
Reference in New Issue