mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(prettier): print big int with lowercase (#1351)
This commit is contained in:
parent
526db66984
commit
bc302f4f8b
2 changed files with 8 additions and 3 deletions
|
|
@ -613,7 +613,13 @@ impl<'a> Format<'a> for NumberLiteral<'a> {
|
|||
|
||||
impl<'a> Format<'a> for BigintLiteral {
|
||||
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
|
||||
Doc::Str(self.span.source_text(p.source_text))
|
||||
let text = self.span.source_text(p.source_text);
|
||||
// Perf: avoid a memory allocation from `to_ascii_lowercase`.
|
||||
if text.contains(|c: char| c.is_lowercase()) {
|
||||
p.str(&text.to_ascii_lowercase())
|
||||
} else {
|
||||
Doc::Str(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Compatibility: 8/173 (4.62%)
|
||||
Compatibility: 9/173 (5.20%)
|
||||
|
||||
# Failed
|
||||
|
||||
|
|
@ -13,7 +13,6 @@ Compatibility: 8/173 (4.62%)
|
|||
* async
|
||||
* async-do-expressions
|
||||
* babel-plugins
|
||||
* big-int
|
||||
* binary-expressions
|
||||
* binary_math
|
||||
* bind-expressions
|
||||
|
|
|
|||
Loading…
Reference in a new issue