X-Git-Url: http://git.squeep.com/?p=squeep-api-dingus;a=blobdiff_plain;f=lib%2Fcommon.js;fp=lib%2Fcommon.js;h=6b72129223cf88e8248706afa5679f853eb5d5ae;hp=f839e7a05cf16790779a75a2d6c15d19689d9f98;hb=1b2868b99eba20b50d88a0d858bcd8c51c5b8f07;hpb=031c170bdaf1d9c331e6f6fc701ce6540c0e6941 diff --git a/lib/common.js b/lib/common.js index f839e7a..6b72129 100644 --- a/lib/common.js +++ b/lib/common.js @@ -5,29 +5,10 @@ * Utility and miscellaneous functions. */ -const path = require('path'); -const crypto = require('crypto'); +const crypto = require('node:crypto'); const uuid = require('uuid'); const Enum = require('./enum'); - -/** - * @callback ScopeFn - * @param {String} scope - * @returns {String} - */ -/** - * Return a function which prefixes a provided scope with the most- - * relevant part of the filename, for use in logging. - * @param {String} filename - * @returns {ScopeFn} - */ -const fileScope = (filename) => { - let fScope = path.basename(filename, '.js'); - if (fScope === 'index') { - fScope = path.basename(path.dirname(filename)); - } - return (scope) => `${fScope}:${scope}`; -}; +const { fileScope } = require('@squeep/log-helper'); /** * Simple ETag from data.