Giter VIP home page Giter VIP logo

Comments (2)

keithamus avatar keithamus commented on August 18, 2024

Is searchParams enumerable? I think a URL will land here:

function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
and each key will be checked by getting the property, so I don't know why it would fail.

Oh... unless you're saying the property that houses Symbol(query) is enumerable?

from deep-eql.

markandrus avatar markandrus commented on August 18, 2024

Hey @keithamus,

Oh... unless you're saying the property that houses Symbol(query) is enumerable?

Yes! Symbol(query) is enumerable, and in Node.js < v18.17.0, Symbol(query) it was always present. Now, in Node.js v18.17.0 (or any version using Ada), Symbol(query) is lazily computed once searchParams is accessed. We can see that here:

Node.js v18.17.0

$ node
Welcome to Node.js v18.17.0.
Type ".help" for more information.
> var url = new URL('foo://bar')
undefined
> Object.getOwnPropertyNames(url)
[]
> Object.getOwnPropertySymbols(url)
[ Symbol(context) ] // ← Symbol(query) is missing
> void url.searchParams
undefined
> Object.getOwnPropertyNames(url)
[]
> Object.getOwnPropertySymbols(url)
[ Symbol(context), Symbol(query) ] // ← Symbol(query) is present and enumerable after accessing searchParams

Node.js v18.13.0

$ node                       
Welcome to Node.js v18.13.0.
Type ".help" for more information.
> var url = new URL('foo://bar')
undefined
> Object.getOwnPropertyNames(url)
[]
> Object.getOwnPropertySymbols(url)
[ Symbol(context), Symbol(query) ] // ← Symbol(query) is present and enumerable
> void url.searchParams
undefined
> Object.getOwnPropertyNames(url)
[]
> Object.getOwnPropertySymbols(url)
[ Symbol(context), Symbol(query) ] // ← Symbol(query) is still present and enumerable

from deep-eql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.