Giter Site home page Giter Site logo

Return value for number 0 about loupe HOT 6 CLOSED

chaijs avatar chaijs commented on June 12, 2024
Return value for number 0

from loupe.

Comments (6)

keithamus avatar keithamus commented on June 12, 2024 1

This is important because many tests assert the difference between +0/-0. We should update Chai to reflect this change.

from loupe.

flaambe avatar flaambe commented on June 12, 2024

And one more question, it seems custom functions don't work, or I have to pass some parameters?

5) utilities
       inspect with custom stylize-calling inspect()s:

      AssertionError: expected '{ outer: { inspect: [Function inspect] } }' to equal '{ outer: Object content }'
      + expected - actual

      -{ outer: { inspect: [Function inspect] } }
      +{ outer: Object content }

from loupe.

keithamus avatar keithamus commented on June 12, 2024

This is a change in the loupe API to avoid surprising behaviours for calls that have an inspect that gets called when it is not desirable. The behaviour is opt in now, so you need to pass customInspect: true, e.g loupe(obj, { customInspect: true }). We can do that inside Chai to avoid breaking change, and turn it off in Chai 5.

from loupe.

flaambe avatar flaambe commented on June 12, 2024

I tried to pass this parameter, but it seems the execution does not reach this line:

loupe/index.js

Line 142 in 0c75417

if (customInspect && value) {

so the result is the same.

from loupe.

keithamus avatar keithamus commented on June 12, 2024

Ahh yeah its because of this above:

loupe/index.js

Lines 129 to 133 in 0c75417

const proto = value ? Object.getPrototypeOf(value) : false
// If it's a plain Object then use Loupe's inspector
if (proto === Object.prototype || proto === null) {
return inspectObject(value, options)
}

We should verify this behaviour works well in Loupe and release a patch. The block I linked above should add !customInspect && as an extra conditional, IMO.

from loupe.

github-actions avatar github-actions commented on June 12, 2024

🎉 This issue has been resolved in version 2.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

from loupe.

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.