or-uk-data-quality-checker/helpers.js
2024-12-18 19:12:08 +00:00

16 lines
No EOL
450 B
JavaScript

function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function toFriendlyFilename(str) {
return str
.trim() // Remove leading and trailing whitespace
.toLowerCase() // Convert to lowercase
.replace(/[^a-z0-9\s]/g, '') // Remove non-alphanumeric characters except spaces
.replace(/\s+/g, '_'); // Replace spaces with underscores
}
module.exports = {
wait,
toFriendlyFilename
};