mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
fix: #3232 fix type definitions of function format to support notations hex, bin, and oct
This commit is contained in:
parent
b6b76cd11e
commit
c118eaec90
@ -1,5 +1,10 @@
|
||||
# History
|
||||
|
||||
# unpublished changes since 13.0.2
|
||||
|
||||
- Fix: #3232 fix type definitions of function `format` to support notations
|
||||
`hex`, `bin`, and `oct`.
|
||||
|
||||
# 2024-07-04, 13.0.2
|
||||
|
||||
- Fix an error in the type definitions of `quantileSeq` (#3223).
|
||||
|
||||
@ -2168,6 +2168,9 @@ Factory Test
|
||||
const d = divide(a, b)
|
||||
assert.strictEqual(format(c), '16/21')
|
||||
assert.strictEqual(format(d), '7/9')
|
||||
assert.strictEqual(format(255, { notation: 'bin' }), '0b11111111')
|
||||
assert.strictEqual(format(255, { notation: 'hex' }), '0xff')
|
||||
assert.strictEqual(format(255, { notation: 'oct' }), '0o377')
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
9
types/index.d.ts
vendored
9
types/index.d.ts
vendored
@ -4352,7 +4352,14 @@ export interface FormatOptions {
|
||||
* elsewhere. Lower bound is included, upper bound is excluded. For
|
||||
* example '123.4' and '1.4e7'.
|
||||
*/
|
||||
notation?: 'fixed' | 'exponential' | 'engineering' | 'auto'
|
||||
notation?:
|
||||
| 'fixed'
|
||||
| 'exponential'
|
||||
| 'engineering'
|
||||
| 'auto'
|
||||
| 'hex'
|
||||
| 'bin'
|
||||
| 'oct'
|
||||
|
||||
/**
|
||||
* A number between 0 and 16 to round the digits of the number. In case
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user