UNPKG

@playcanvas/react

Version:

A React renderer for PlayCanvas – build interactive 3D applications using React's declarative paradigm.

18 lines 637 B
/** * Create a stable string representation of an object * * @param {Record<string, unknown>} obj - The object to create a stable key for * @returns {string} A stable string representation of the object */ export function getStableKey(obj) { if (!obj || typeof obj !== 'object') return JSON.stringify(obj); // Sort keys to ensure consistent ordering const sortedKeys = Object.keys(obj).sort(); const sortedObj = sortedKeys.reduce((result, key) => { result[key] = getStableKey(obj[key]); return result; }, {}); return JSON.stringify(sortedObj); } //# sourceMappingURL=stable-key.js.map