Skip to content

Commit

Permalink
helperFunctions update
Browse files Browse the repository at this point in the history
  • Loading branch information
RNEvok committed Jul 18, 2024
1 parent 8de2250 commit 4f01fe2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions helpers/helperFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ export const emptyMobxStoreMonitor: MobxStoreMonitor = [
() => {}
];

export const stringIsJson = (s: string) => {
let value;

try {
value = JSON.parse(s);
} catch (e) {
return false;
}
return typeof value === "object";
}

// JSON.stringify replacer function constructor that adds full path to current position as last arg of replacer
// Explanation fo replacerWithPath decorator:
// > 'this' inside 'return function' point to field parent object
Expand Down

0 comments on commit 4f01fe2

Please sign in to comment.