Remove unused jsUtils module
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RaRBJFZKSTA7naHGuQHfnQ
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
// The Lucia project.
|
||||
// Copyright 2023-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// chiayin.kuo@dsp.im (chiayin), 2023/1/31
|
||||
// imacat.yang@dsp.im (imacat), 2023/9/23
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
/** @module jsUtils General JavaScript utility functions. */
|
||||
|
||||
/**
|
||||
* Recursively prints an object's properties to the console.
|
||||
* @param {Object} obj - The object to print.
|
||||
* @param {number} [indent=0] - The current indentation level.
|
||||
*/
|
||||
export const printObject = (obj, indent = 0) => {
|
||||
const padding = " ".repeat(indent);
|
||||
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
if (typeof obj[key] === "object" && obj[key] !== null) {
|
||||
console.log(`${padding}${key}: {`);
|
||||
printObject(obj[key], indent + 2);
|
||||
console.log(`${padding}}`);
|
||||
} else {
|
||||
console.log(`${padding}${key}: ${obj[key]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a cryptographically random integer between 0 and max (inclusive).
|
||||
* @param {number} max - The upper bound (inclusive).
|
||||
* @returns {number} A random integer in [0, max].
|
||||
*/
|
||||
export const getRandomInt = (max) => {
|
||||
const array = new Uint32Array(1);
|
||||
globalThis.crypto.getRandomValues(array);
|
||||
return Math.floor((array[0] / (0xffffffff + 1)) * (max + 1));
|
||||
};
|
||||
Reference in New Issue
Block a user