Giter VIP home page Giter VIP logo

Comments (9)

Emiyaaaaa avatar Emiyaaaaa commented on June 9, 2024

@sindresorhus

from type-fest.

sindresorhus avatar sindresorhus commented on June 9, 2024

I think it should be opt-in. Map would require using a different way to access the values using the path components.

Set does not make sense as it's not indexed.

from type-fest.

Emiyaaaaa avatar Emiyaaaaa commented on June 9, 2024

Map would require using a different way to access the values using the path components.

I agree opt-in, but it doesn't seem possible to use string to represent all type of the keys in Map, like object key.
The most we can do is to access only the string/number keys in Map.

from type-fest.

sindresorhus avatar sindresorhus commented on June 9, 2024

That's fine.

from type-fest.

Emiyaaaaa avatar Emiyaaaaa commented on June 9, 2024

@sindresorhus I thought about it more. If the reason for using opt-in is that access to a map is different from access to an object, but if the user chooses recurseInMap, the final result is still indistinguishable from a map or an object.

so maybe opt-in isn't necessary?

and if we can't tell the difference between the path of map or object, should we don't recurse in?

from type-fest.

sindresorhus avatar sindresorhus commented on June 9, 2024

The main reason for making it opt-in, is that most times when you need to get the paths, you don't support Map. For example, with https://github.com/sindresorhus/dot-prop, I don't support Map, so I wouldn't want the user to get autocomplete for Map keys.

from type-fest.

Emiyaaaaa avatar Emiyaaaaa commented on June 9, 2024

The main reason for making it opt-in, is that most times when you need to get the paths, you don't support Map. For example, with https://github.com/sindresorhus/dot-prop, I don't support Map, so I wouldn't want the user to get autocomplete for Map keys.

got it. maybe we shoudn't support recurse into map?

from type-fest.

sindresorhus avatar sindresorhus commented on June 9, 2024

Yeah, maybe we should wait until someone requests it. I personally don't have any need for it.

from type-fest.

Emiyaaaaa avatar Emiyaaaaa commented on June 9, 2024

Yeah, maybe we should wait until someone requests it. I personally don't have any need for it.

ok, but look at image in the description, there is still a bug that Paths should not recurse into Map's prototype properties.

from type-fest.

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.