|
@@ -52,4 +52,15 @@ export function strToInt(string) {
|
|
|
*/
|
|
|
export function clamp(value, min = -1, max = 1) {
|
|
|
return Math.max(min, Math.min(max, value));
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Deep clone a value
|
|
|
+ *
|
|
|
+ * @param {any} value
|
|
|
+ *
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+export function deepClone(value) {
|
|
|
+ return JSON.parse(JSON.stringify(value));
|
|
|
}
|