Skip to content

docs: Explain parsing numbers with no digits after dot. #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ If the `quantity` argument cannot be parsed as a number, returns `false`.
the unit. Instead, you should pass it single quantities only. Parse `1px solid black`, then pass it
the stringified `1px` node (a `word` node) to parse the number and unit.

Quantities of the form `2.rem` (no digits after the dot) are not valid CSS. In this case, instead of
throwing an error, `unit()` returns the dot as part of the unit:

```js
// Given 2.rem
{
number: '2',
unit: '.rem'
}
```

### valueParser.stringify(nodes[, custom])

Stringifies a node or array of nodes.
Expand Down