Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
deps: update interface-datastore and aegir (#29)
Browse files Browse the repository at this point in the history
Not a breaking change as interface-datastore is not part of the public api
  • Loading branch information
achingbrain authored Mar 13, 2023
1 parent a24089e commit 451d936
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dist
node_modules
package-lock.json
yarn.lock
.vscode
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [Browser `<script>` tag](#browser-script-tag)
- [Description](#description)
- [Example](#example)
- [API Docs](#api-docs)
- [License](#license)
- [Contribution](#contribution)

Expand Down Expand Up @@ -60,6 +61,10 @@ with this base58btc: Qmfoo
with this base32: bafyfoo
```

## API Docs

- <https://libp2p.github.io/js-libp2p-logger>

## License

Licensed under either of
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@
"dependencies": {
"@libp2p/interface-peer-id": "^2.0.0",
"debug": "^4.3.3",
"interface-datastore": "^7.0.0",
"interface-datastore": "^8.0.0",
"multiformats": "^11.0.0"
},
"devDependencies": {
"@types/debug": "^4.1.7",
"aegir": "^37.9.1"
"aegir": "^38.1.7"
}
}
18 changes: 9 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@ import type { CID } from 'multiformats/cid'
import type { Key } from 'interface-datastore'

// Add a formatter for converting to a base58 string
debug.formatters.b = (v?: Uint8Array) => {
debug.formatters.b = (v?: Uint8Array): string => {
return v == null ? 'undefined' : base58btc.baseEncode(v)
}

// Add a formatter for converting to a base32 string
debug.formatters.t = (v?: Uint8Array) => {
debug.formatters.t = (v?: Uint8Array): string => {
return v == null ? 'undefined' : base32.baseEncode(v)
}

// Add a formatter for converting to a base64 string
debug.formatters.m = (v?: Uint8Array) => {
debug.formatters.m = (v?: Uint8Array): string => {
return v == null ? 'undefined' : base64.baseEncode(v)
}

// Add a formatter for stringifying peer ids
debug.formatters.p = (v?: PeerId) => {
debug.formatters.p = (v?: PeerId): string => {
return v == null ? 'undefined' : v.toString()
}

// Add a formatter for stringifying CIDs
debug.formatters.c = (v?: CID) => {
debug.formatters.c = (v?: CID): string => {
return v == null ? 'undefined' : v.toString()
}

// Add a formatter for stringifying Datastore keys
debug.formatters.k = (v: Key) => {
debug.formatters.k = (v: Key): string => {
return v == null ? 'undefined' : v.toString()
}

Expand All @@ -50,14 +50,14 @@ export function logger (name: string): Logger {
})
}

export function disable () {
export function disable (): void {
debug.disable()
}

export function enable (namespaces: string) {
export function enable (namespaces: string): void {
debug.enable(namespaces)
}

export function enabled (namespaces: string) {
export function enabled (namespaces: string): boolean {
return debug.enabled(namespaces)
}

0 comments on commit 451d936

Please sign in to comment.