-'use strict';
-
-const path = require('path');
-const { randomBytes } = require('crypto');
-const { promisify } = require('util');
-const randomBytesAsync = promisify(randomBytes);
-
-
-/**
- * Return a function which combines a part of the filename with a scope, for use in logging.
- * @param {string} filename
- */
-const fileScope = (filename) => {
- let fScope = path.basename(filename, '.js');
- if (fScope === 'index') {
- fScope = path.basename(path.dirname(filename));
- }
- return (scope) => `${fScope}:${scope}`;
-}
-
-
-/**
- * Return an array containing x if x is something and not an array
- * @param {*} x
- */
-const ensureArray = (x) => {
- if (x === undefined) {
- return [];
- }
- if (!Array.isArray(x)) {
- return Array(x);
- }
- return x;
-};
-
-
-module.exports = {
- ensureArray,
- fileScope,
- randomBytesAsync,
-};
\ No newline at end of file