all files / oak-tools/ index.js

75% Statements 9/12
100% Branches 0/0
40% Functions 2/5
75% Lines 9/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60                            11×                                                                          
 
const { join } = require('path')
 
/**
 * oak-tools module
 * @version 0.2.0
 * @module oak-tools
 */
 
/**
 * Logger object
 * @param {Object} options options object
 * @param {Function} callback callback function
 * @returns {Logger}
 */
module.exports.logger = function () {
  return require(join(__dirname, 'lib', 'logger')).apply(this, arguments)
}
 
/**
 * Message class
 * @returns {Message}
 */
module.exports.message = function () {
  return require(join(__dirname, 'lib', 'message'))
}
 
/**
 * Starts a messaging server
 * @param {String} type Type of server
 * @returns {WebSocketServer}
 */
module.exports.server = function (type) {
  return require(join(__dirname, 'lib', type, 'server'))
}
 
/**
 * Starts a messaging client
 * @param {String} type Type of client
 * @returns {WebSocketClient}
 */
module.exports.client = function (type) {
  return require(join(__dirname, 'lib', type, 'client'))
}
 
/**
 * Service discovery
 * @param {String} type Type of discovery
 * @returns {Mdns}
 */
module.exports.discovery = function (type = 'mdns') {
  return require(join(__dirname, 'lib', 'discovery', type))
}
 
/**
 * Swagger client generator
 * @returns {Util}
 */
module.exports.api = require(join(__dirname, 'lib', 'api'))