mathjs 12.3.0 → 12.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/HISTORY.md +19 -0
  2. package/lib/browser/math.js +1 -1
  3. package/lib/browser/math.js.LICENSE.txt +2 -2
  4. package/lib/browser/math.js.map +1 -1
  5. package/lib/cjs/entry/configReadonly.js +1 -1
  6. package/lib/cjs/entry/dependenciesAny/dependenciesHelpClass.generated.js +2 -2
  7. package/lib/cjs/entry/dependenciesNumber/dependenciesHelpClass.generated.js +2 -2
  8. package/lib/cjs/entry/impureFunctionsAny.generated.js +14 -14
  9. package/lib/cjs/entry/impureFunctionsNumber.generated.js +1 -1
  10. package/lib/cjs/entry/pureFunctionsAny.generated.js +11 -11
  11. package/lib/cjs/expression/Help.js +21 -4
  12. package/lib/cjs/function/string/bin.js +3 -3
  13. package/lib/cjs/function/string/format.js +3 -3
  14. package/lib/cjs/function/string/hex.js +3 -3
  15. package/lib/cjs/function/string/oct.js +3 -3
  16. package/lib/cjs/header.js +2 -2
  17. package/lib/cjs/type/unit/physicalConstants.js +1 -1
  18. package/lib/cjs/utils/bignumber/formatter.js +17 -27
  19. package/lib/cjs/utils/number.js +75 -33
  20. package/lib/cjs/version.js +1 -1
  21. package/lib/esm/entry/configReadonly.js +1 -1
  22. package/lib/esm/entry/dependenciesAny/dependenciesHelpClass.generated.js +2 -2
  23. package/lib/esm/entry/dependenciesNumber/dependenciesHelpClass.generated.js +2 -2
  24. package/lib/esm/entry/impureFunctionsAny.generated.js +16 -16
  25. package/lib/esm/entry/impureFunctionsNumber.generated.js +1 -1
  26. package/lib/esm/entry/pureFunctionsAny.generated.js +12 -12
  27. package/lib/esm/expression/Help.js +21 -4
  28. package/lib/esm/function/string/bin.js +3 -3
  29. package/lib/esm/function/string/format.js +3 -3
  30. package/lib/esm/function/string/hex.js +3 -3
  31. package/lib/esm/function/string/oct.js +3 -3
  32. package/lib/esm/type/unit/physicalConstants.js +1 -1
  33. package/lib/esm/utils/bignumber/formatter.js +19 -28
  34. package/lib/esm/utils/number.js +76 -34
  35. package/lib/esm/version.js +1 -1
  36. package/package.json +11 -11
  37. package/types/index.d.ts +30 -18
package/types/index.d.ts CHANGED
@@ -183,11 +183,11 @@ export interface ArrayNode<TItems extends MathNode[] = MathNode[]>
183
183
  extends MathNode {
184
184
  type: 'ArrayNode'
185
185
  isArrayNode: true
186
- items: TItems
186
+ items: [...TItems]
187
187
  }
188
188
  export interface ArrayNodeCtor {
189
189
  new <TItems extends MathNode[] = MathNode[]>(
190
- items: MathNode[]
190
+ items: [...TItems]
191
191
  ): ArrayNode<TItems>
192
192
  }
193
193
 
@@ -283,12 +283,12 @@ export interface FunctionNode<
283
283
  type: 'FunctionNode'
284
284
  isFunctionNode: true
285
285
  fn: TFn
286
- args: TArgs
286
+ args: [...TArgs]
287
287
  }
288
288
  export interface FunctionNodeCtor {
289
289
  new <TFn = SymbolNode, TArgs extends MathNode[] = MathNode[]>(
290
290
  fn: TFn,
291
- args: TArgs
291
+ args: [...TArgs]
292
292
  ): FunctionNode<TFn, TArgs>
293
293
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
294
294
  onUndefinedFunction: (name: string) => any
@@ -298,13 +298,13 @@ export interface IndexNode<TDims extends MathNode[] = MathNode[]>
298
298
  extends MathNode {
299
299
  type: 'IndexNode'
300
300
  isIndexNode: true
301
- dimensions: TDims
301
+ dimensions: [...TDims]
302
302
  dotNotation: boolean
303
303
  }
304
304
  export interface IndexNodeCtor {
305
- new <TDims extends MathNode[] = MathNode[]>(dimensions: TDims): IndexNode
305
+ new <TDims extends MathNode[] = MathNode[]>(dimensions: [...TDims]): IndexNode
306
306
  new <TDims extends MathNode[] = MathNode[]>(
307
- dimensions: TDims,
307
+ dimensions: [...TDims],
308
308
  dotNotation: boolean
309
309
  ): IndexNode<TDims>
310
310
  }
@@ -367,7 +367,7 @@ export interface OperatorNode<
367
367
  isOperatorNode: true
368
368
  op: TOp
369
369
  fn: TFn
370
- args: TArgs
370
+ args: [...TArgs]
371
371
  implicit: boolean
372
372
  isUnary(): boolean
373
373
  isBinary(): boolean
@@ -381,7 +381,7 @@ export interface OperatorNodeCtor extends MathNode {
381
381
  >(
382
382
  op: TOp,
383
383
  fn: TFn,
384
- args: TArgs,
384
+ args: [...TArgs],
385
385
  implicit?: boolean
386
386
  ): OperatorNode<TOp, TFn, TArgs>
387
387
  }
@@ -423,12 +423,12 @@ export interface RelationalNode<TParams extends MathNode[] = MathNode[]>
423
423
  type: 'RelationalNode'
424
424
  isRelationalNode: true
425
425
  conditionals: string[]
426
- params: TParams
426
+ params: [...TParams]
427
427
  }
428
428
  export interface RelationalNodeCtor {
429
429
  new <TParams extends MathNode[] = MathNode[]>(
430
430
  conditionals: string[],
431
- params: TParams
431
+ params: [...TParams]
432
432
  ): RelationalNode<TParams>
433
433
  }
434
434
 
@@ -1200,7 +1200,8 @@ export interface MathJsInstance extends MathJsFactory {
1200
1200
  * whole matrix.
1201
1201
  * @returns Returns the hypothenuse of the input values.
1202
1202
  */
1203
- hypot<T extends (number | BigNumber)[]>(...args: T[]): T
1203
+ hypot<T extends number | BigNumber>(...args: T[]): T
1204
+ hypot<T extends number | BigNumber>(args: T[]): T
1204
1205
 
1205
1206
  /**
1206
1207
  * Calculate the least common multiple for two or more values or arrays.
@@ -3012,7 +3013,7 @@ export interface MathJsInstance extends MathJsFactory {
3012
3013
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3013
3014
  value: any,
3014
3015
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3015
- options?: FormatOptions | number | ((item: any) => string),
3016
+ options?: FormatOptions | number | BigNumber | ((item: any) => string),
3016
3017
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3017
3018
  callback?: (value: any) => string
3018
3019
  ): string
@@ -3860,8 +3861,10 @@ export interface Matrix {
3860
3861
  ): void
3861
3862
  toArray(): MathArray
3862
3863
  valueOf(): MathArray
3863
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3864
- format(options?: FormatOptions | number | ((value: any) => string)): string
3864
+ format(
3865
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3866
+ options?: FormatOptions | number | BigNumber | ((value: any) => string)
3867
+ ): string
3865
3868
  toString(): string
3866
3869
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3867
3870
  toJSON(): any
@@ -4252,19 +4255,19 @@ export interface FormatOptions {
4252
4255
  * case of notation 'fixed', precision defines the number of significant
4253
4256
  * digits after the decimal point, and is 0 by default.
4254
4257
  */
4255
- precision?: number
4258
+ precision?: number | BigNumber
4256
4259
 
4257
4260
  /**
4258
4261
  * Exponent determining the lower boundary for formatting a value with
4259
4262
  * an exponent when notation='auto. Default value is -3.
4260
4263
  */
4261
- lowerExp?: number
4264
+ lowerExp?: number | BigNumber
4262
4265
 
4263
4266
  /**
4264
4267
  * Exponent determining the upper boundary for formatting a value with
4265
4268
  * an exponent when notation='auto. Default value is 5.
4266
4269
  */
4267
- upperExp?: number
4270
+ upperExp?: number | BigNumber
4268
4271
 
4269
4272
  /**
4270
4273
  * Available values: 'ratio' (default) or 'decimal'. For example
@@ -4272,6 +4275,15 @@ export interface FormatOptions {
4272
4275
  * and will output 0.(3) when 'decimal' is configured.
4273
4276
  */
4274
4277
  fraction?: string
4278
+
4279
+ /**
4280
+ * The word size in bits to use for formatting in binary, octal, or
4281
+ * hexadecimal notation. To be used only with `'bin'`, `'oct'`, or `'hex'`
4282
+ * values for `notation` option. When this option is defined the value
4283
+ * is formatted as a signed twos complement integer of the given word
4284
+ * size and the size suffix is appended to the output.
4285
+ */
4286
+ wordSize?: number | BigNumber
4275
4287
  }
4276
4288
 
4277
4289
  export interface Help {