Advertisement
SimpleCookie

Untitled

May 17th, 2024
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function extractValues(input) {
  2.   // Extract object name
  3.   let start = input.indexOf("'") + 1;
  4.   let end = input.indexOf("'", start);
  5.   const objectName = input.substring(start, end);
  6.  
  7.   // Extract field name
  8.   start = input.indexOf("'$.") + 3;
  9.   end = input.indexOf("'", start);
  10.   const fieldName = input.substring(start, end);
  11.  
  12.   // Extract rejected value
  13.   start = input.indexOf("[") + 1;
  14.   end = input.indexOf("]", start);
  15.   const rejectedValue = input.substring(start, end);
  16.  
  17.   return { objectName, fieldName, rejectedValue };
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement