Code Monkey home page Code Monkey logo

Comments (4)

romm avatar romm commented on August 19, 2024

Hi @novafree1, in this particular case you are mapping to an object that has only one property, this is why you encounter this exception. If you call the map method with null as a second argument, the default value will be used and no exception will be raised.

Also note that if there are at least two parameters in your constructor, there will be no issue calling the mapper with [].

I'm not worried by cases like your example, because there is no real added value using Valinor for a use case as simple as the one you described — I guess you were just toying around with the library to see how you could use it in a real project?

from valinor.

novafree1 avatar novafree1 commented on August 19, 2024

Hi!

Thank You for Your response. You done supper useful component. I checked default values on object with several values, yes it's working fine. But I think that behavior of the component should be the same regardless of parameters count. I agree that situation with one default parameter is rare, but it can be. For example when user working with some entity and need to confirm some action. entityId and action is part of the url confirm checkbox is post parameter. If user not confirm checkbox action can not proceed. So missing agree parameter and agree parameter with 0 value should be treated the same.

from valinor.

romm avatar romm commented on August 19, 2024

Hi @novafree1, better late than never 🙂 — #159 should fix this issue. Can you try it out on your side and give feedback?

from valinor.

romm avatar romm commented on August 19, 2024

Fixed with #159.

from valinor.

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.