فهرست منبع

Add DeepClone function

ApisNecros 1 سال پیش
والد
کامیت
823ee1090b
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      common.ts

+ 10 - 0
common.ts

@@ -25,4 +25,14 @@ export async function LoadInput(dayNumber: number): Promise<string[]> {
  */
 export function Inspect(value: any): void {
 	console.log(util.inspect(value, { breakLength: Infinity, colors: true, depth: 256 }));
+}
+
+/**
+ * Deep clone any input
+ *
+ * @param {any} value A value to clone
+ * @returns A clone of the input
+ */
+export function DeepClone(value: any): any {
+	return JSON.parse(JSON.stringify(value));
 }