27 lines
532 B
JavaScript
27 lines
532 B
JavaScript
|
// @ts-check
|
||
|
|
||
|
const https = require("https");
|
||
|
const http = require("http");
|
||
|
|
||
|
/**
|
||
|
* @typedef {object} GrabHostNamesReturn
|
||
|
* @property {string} host
|
||
|
* @property {number | string} port
|
||
|
* @property {typeof http | typeof https} scheme
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* # Trim SQL
|
||
|
* @description Remove Returns and miltiple spaces from SQL Query
|
||
|
* @param {string} sql
|
||
|
* @returns {string}
|
||
|
*/
|
||
|
function trimSql(sql) {
|
||
|
return sql
|
||
|
.replace(/\n|\r|\n\r|\r\n/gm, " ")
|
||
|
.replace(/ {2,}/g, " ")
|
||
|
.trim();
|
||
|
}
|
||
|
|
||
|
module.exports = trimSql;
|