Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
Copy object with function as a property in DevTools

When copying an object with function as a property in the chrome console, the property is lost at all. How to use copy() in DevTools and copy a whole property without losing anything?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The only way I see about copying json with function property to clipboard

const isArrowFn = (fn) => 
  (typeof fn === 'function') &&
  !/^(?:(?:\/\*[^(?:\*\/)]*\*\/\s*)|(?:\/\/[^\r\n]*))*\s*(?:(?:(?:async\s(?:(?:\/\*[^(?:\*\/)]*\*\/\s*)|(?:\/\/[^\r\n]*))*\s*)?function|class)(?:\s|(?:(?:\/\*[^(?:\*\/)]*\*\/\s*)|(?:\/\/[^\r\n]*))*)|(?:[_$\w][\w0-9_$]*\s*(?:\/\*[^(?:\*\/)]*\*\/\s*)*\s*\())/.test(fn.toString());


copy(
  JSON.parse(
    JSON.stringify(obj, (key, val) => {
      if (typeof val === "function")
        return !isArrowFn(val)
          ? val.toString().substring(
              val.toString().indexOf("{") + 1,
              val.toString().lastIndexOf("}")
            )
          : val.toString();
      return val;
    })
  )
);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!