mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-10-07 22:57:07 +00:00
docs: Do not document utils. They are not exposed externally.
This commit is contained in:
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* Creates an id from an alphanumeric character list.
|
||||
* @param {number} [length=32] The length of the id.
|
||||
* @return {string} An id.
|
||||
* @see {@link https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript}
|
||||
* @memberof module:Utils
|
||||
*/
|
||||
const createId = async (length = 32) => {
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
||||
let result = ''
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
import pathJoin from './path-join.js'
|
||||
|
||||
/**
|
||||
* Checks that the given address has '/_access' as the last part.
|
||||
* @function
|
||||
* @param {string} address The address to check.
|
||||
* @return {string} The address appended with /_access.
|
||||
* @memberof module:Utils
|
||||
*/
|
||||
export default address => {
|
||||
const suffix = address.toString().split('/').pop()
|
||||
return suffix === '_access'
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
/**
|
||||
* Various utility functions.
|
||||
* @module Utils
|
||||
*/
|
||||
|
||||
import createId from './create-id.js'
|
||||
|
||||
export {
|
||||
|
||||
@@ -1,35 +1,12 @@
|
||||
/**
|
||||
* A posix-compatible verions of join.
|
||||
* @function posixJoin
|
||||
* @param {...string} paths or more strings to join.
|
||||
* @return {string} The joined strings.
|
||||
* @memberof module:Utils
|
||||
*/
|
||||
export const posixJoin = (...paths) => paths
|
||||
.join('/')
|
||||
.replace(/((?<=\/)\/+)|(^\.\/)|((?<=\/)\.\/)/g, '') || '.'
|
||||
|
||||
/**
|
||||
* A windows-compatible verions of join.
|
||||
* @function win32Join
|
||||
* @param {...string} One or more strings to join.
|
||||
* @return {string} The joined strings.
|
||||
* @memberof module:Utils
|
||||
*/
|
||||
export const win32Join = (...paths) => paths
|
||||
.join('\\')
|
||||
.replace(/\//g, '\\')
|
||||
.replace(/((?<=\\)\\+)|(^\.\\)|((?<=\\)\.\\)/g, '') || '.'
|
||||
|
||||
/**
|
||||
* An alias for posixJoin.
|
||||
* @function join
|
||||
* @alias posixJoin
|
||||
* @param {...string} paths or more strings to join.
|
||||
* @return {string} The joined strings.
|
||||
* @memberof module:Utils
|
||||
* @static
|
||||
*/
|
||||
export const join = posixJoin
|
||||
|
||||
export default posixJoin
|
||||
|
||||
Reference in New Issue
Block a user