question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The question/issue is probably as weird as the title is.

I’m trying to figure out what ctx.query is. This is what I’m talking about:

console.log({
  obj: ctx.query,
  type: typeof ctx.query,
  prototype: ctx.query.prototype,
  constructor: ctx.query.constructor,
  isObj: ctx.query.constructor === Object,
});

Result:

{ obj: { name: 'test' },
  type: 'object',
  prototype: undefined,
  constructor: undefined,
  isObj: false }

Why is it not a pojo? What is its constructor? I can easily work around this by using Object.assign({}, ctx.query) but I’m really curious.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fl0wcommented, Apr 1, 2019

Yea, { ...obj } is syntactic sugar for Object.assign.

0reactions
RWOverdijkcommented, Apr 1, 2019

I’m using Object.assign, which works as well. I wish I could detect it instead of forcing it though, so I’ll find a way.

Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Query? - Definition from Techopedia
A query is a request for data or information from a database table or combination of tables. This data may be generated as...
Read more >
What is a database query? - TechTarget
A query is a question or a request for information expressed in a formal manner. In computer science, a query is essentially the...
Read more >
What Is a Query? Database Query Explained - Hostinger
In standard English, a query means a request for information. In computer programming, it refers to the same thing, except the information is...
Read more >
Query Definition & Meaning - Merriam-Webster
1 · to ask questions of especially with a desire for authoritative information ; 2 · to ask questions about especially in order...
Read more >
Introduction to queries - Microsoft Support
A query can give you an answer to a simple question, perform calculations, combine data from different tables, add, change, or delete data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found