mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
docs: Do not expose internal OrbitDBAddress function.
This commit is contained in:
parent
e6f86fa203
commit
578f4890b9
@ -57,41 +57,15 @@ const parseAddress = (address) => {
|
|||||||
return OrbitDBAddress(address)
|
return OrbitDBAddress(address)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an instance of OrbitDBAddress.
|
|
||||||
* @function
|
|
||||||
* @param {OrbitDBAddress|string} address A valid OrbitDB database address.
|
|
||||||
* @return {OrbitDBAddress} An instance of OrbitDBAddress.
|
|
||||||
* @instance
|
|
||||||
*/
|
|
||||||
const OrbitDBAddress = (address) => {
|
const OrbitDBAddress = (address) => {
|
||||||
/**
|
|
||||||
* @namespace module:Address~OrbitDBAddress
|
|
||||||
* @description The instance returned by {@link module:Address~OrbitDBAddress}.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (address && address.protocol === 'orbitdb' && address.path) {
|
if (address && address.protocol === 'orbitdb' && address.path) {
|
||||||
return address
|
return address
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The 'orbitdb' protocol.
|
|
||||||
* @memberof module:Address~OrbitDBAddress
|
|
||||||
*/
|
|
||||||
const protocol = 'orbitdb'
|
const protocol = 'orbitdb'
|
||||||
|
|
||||||
/**
|
|
||||||
* The path without the /orbitdb/ prefix.
|
|
||||||
* @memberof module:Address~OrbitDBAddress
|
|
||||||
*/
|
|
||||||
const path = address.replace('/orbitdb/', '').replace('\\orbitdb\\', '')
|
const path = address.replace('/orbitdb/', '').replace('\\orbitdb\\', '')
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns OrbitDBAddress as a string.
|
|
||||||
* @function
|
|
||||||
* @return {string} The string form of OrbitDBAddress.
|
|
||||||
* @memberof module:Address~OrbitDBAddress
|
|
||||||
*/
|
|
||||||
const toString = () => {
|
const toString = () => {
|
||||||
return posixJoin('/', protocol, path)
|
return posixJoin('/', protocol, path)
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ export {
|
|||||||
} from './db/index.js'
|
} from './db/index.js'
|
||||||
|
|
||||||
export {
|
export {
|
||||||
default as OrbitDBAddress,
|
|
||||||
isValidAddress,
|
isValidAddress,
|
||||||
parseAddress
|
parseAddress
|
||||||
} from './address.js'
|
} from './address.js'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { strictEqual, notStrictEqual, deepStrictEqual } from 'assert'
|
import { strictEqual, notStrictEqual, deepStrictEqual } from 'assert'
|
||||||
import { OrbitDBAddress, isValidAddress, parseAddress } from '../src/index.js'
|
import { default as OrbitDBAddress, isValidAddress, parseAddress } from '../src/address.js'
|
||||||
|
|
||||||
describe('Address', function () {
|
describe('Address', function () {
|
||||||
describe('Creating an address from full address string', () => {
|
describe('Creating an address from full address string', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user