@samitouri / QOS-React-1 / commits / aceacce5e2

[sprout] Add a mutate utility function

Sathya Gunasekaran committed Aug 23, 2023 at 17:37 UTC aceacce5e265cffc8189a740ed634e1c9b9e8bdd
1 file changed +8
compiler/packages/sprout/src/shared-runtime.ts
+8
@@ -32,6 +32,14 @@ export const CONST_NUMBER2 = 2;
32 export const CONST_TRUE = true;
33 export const CONST_FALSE = false;
34
35 +let count: number = 0;
36 +export function mutate(arg: any): void {
37 + // don't mutate primitive
38 + if (typeof arg != null && typeof arg === "object") {
39 + arg["wat" + count++] = "joe";
40 + }
41 +}
42 +
43 export function graphql(value: string): string {
44 return value;
45 }