prs-utils
Version:
Prs Utilities
38 lines (34 loc) • 1.03 kB
JavaScript
import { guid } from "./utils.js"
import { timestamp } from "./utils.js"
import { timestampIso } from "./utils.js"
import { getCurrentTimeInfo } from "./utils.js"
import { base64UrlEncode } from "./utils.js"
import { base64UrlDecode } from "./utils.js"
import { uni } from "./utils.js"
import { gei } from "./utils.js"
import { log } from "./utils.js"
import { sendJsonFileToClient } from "./utils-front.js"
import { sendTextFileToClient } from "./utils-front.js"
export function tr(str) {
if (str == null) return ""
if (typeof str === "string") return str.trim()
if (typeof str === "boolean") return str + ""
if (typeof str === "number") return (str + "").trim()
if (typeof str === "bigint") return (str + "").trim()
if (typeof str === "object") return JSON.stringify(str)
return ""
}
export default {
tr,
getCurrentTimeInfo,
timestamp,
timestampIso,
guid,
base64UrlDecode,
base64UrlEncode,
sendTextFileToClient,
sendJsonFileToClient,
uni,
gei,
log,
}