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

152
Views
How to detect usage of `{}` in JS?

It is possible to detect the usage of {} in JS code with test framework Jasmine by spying on a certain internal JS method / property?

For example:

describe('tests', () => {
  it('test1', async () => {
    const spy = spyOn(Object, '???').and.callThrough();
    const x = {};
    expect(spy).toHaveBeenCalled();
  });
  it('test2', async () => {
    const spy = spyOn(Object, '???').and.callThrough();
    const x = null || {};
    expect(spy).toHaveBeenCalled();
  });
});

The spy should only be called when creating an object with {}, not when creating it with Object.create(null). So it may be something related to inheritance from the global JS object prototype that could help.

about 4 years ago · Juan Pablo Isaza
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!