util: if present, fallback to `toString` using the %s formatter by BridgeAR · Pull Request #27621 · nodejs/node

@nodejs-github-bot added the util

Issues and PRs related to the built-in util module.

label

May 9, 2019

addaleax

Fishrock123

silverwind

@BridgeAR BridgeAR added the author ready

PRs that have at least one approval, no pending requests for changes, and a CI started.

label

May 15, 2019
This includes the information that some inputs are handled
differently than others (e.g., `Symbols` are partially represented
as `NaN`).
This makes sure that `util.format` uses `String` to stringify an object
in case the object has an own property named `toString` with type
`function`. That way objects that do not have such function are still
inspected using `util.inspect` and the old behavior is preserved as
well.

BridgeAR added a commit to BridgeAR/node that referenced this pull request

May 20, 2019
This includes the information that some inputs are handled
differently than others (e.g., `Symbols` are partially represented
as `NaN`).

PR-URL: nodejs#27621
Reviewed-By: Roman Reiss <me@silverwind.io>

BridgeAR added a commit to BridgeAR/node that referenced this pull request

May 20, 2019
This makes sure that `util.format` uses `String` to stringify an object
in case the object has an own property named `toString` with type
`function`. That way objects that do not have such function are still
inspected using `util.inspect` and the old behavior is preserved as
well.

PR-URL: nodejs#27621
Refs: jestjs/jest#8443
Reviewed-By: Roman Reiss <me@silverwind.io>

targos pushed a commit that referenced this pull request

May 20, 2019
This includes the information that some inputs are handled
differently than others (e.g., `Symbols` are partially represented
as `NaN`).

PR-URL: #27621
Reviewed-By: Roman Reiss <me@silverwind.io>

targos pushed a commit that referenced this pull request

May 20, 2019
This makes sure that `util.format` uses `String` to stringify an object
in case the object has an own property named `toString` with type
`function`. That way objects that do not have such function are still
inspected using `util.inspect` and the old behavior is preserved as
well.

PR-URL: #27621
Refs: jestjs/jest#8443
Reviewed-By: Roman Reiss <me@silverwind.io>

@BridgeAR BridgeAR deleted the odd-to-string-behavior branch

January 20, 2020 12:04