@math.gl/core 3.6.0-alpha.2 → 3.6.0-alpha.5

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.
package/src/lib/common.ts CHANGED
@@ -6,9 +6,9 @@ import assert from './assert';
6
6
  import type MathArray from '../classes/base/math-array';
7
7
 
8
8
  export type ConfigurationOptions = {
9
- EPSILON?: number;
9
+ EPSILON: number;
10
10
  debug?: boolean;
11
- precision?: number;
11
+ precision: number;
12
12
  printTypes?: boolean;
13
13
  printDegrees?: boolean;
14
14
  printRowMajor?: boolean;
@@ -19,17 +19,16 @@ const RADIANS_TO_DEGREES = (1 / Math.PI) * 180;
19
19
  const DEGREES_TO_RADIANS = (1 / 180) * Math.PI;
20
20
 
21
21
  // TODO - remove
22
- /* eslint-disable no-shadow */
23
- export const config: ConfigurationOptions = {};
24
-
25
- config.EPSILON = 1e-12;
26
- config.debug = false;
27
- config.precision = 4;
28
- config.printTypes = false;
29
- config.printDegrees = false;
30
- config.printRowMajor = true;
22
+ export const config: ConfigurationOptions = {
23
+ EPSILON: 1e-12,
24
+ debug: false,
25
+ precision: 4,
26
+ printTypes: false,
27
+ printDegrees: false,
28
+ printRowMajor: true
29
+ };
31
30
 
32
- export function configure(options: ConfigurationOptions = {}): ConfigurationOptions {
31
+ export function configure(options?: Partial<ConfigurationOptions>): ConfigurationOptions {
33
32
  // Only copy existing keys
34
33
  for (const key in options) {
35
34
  assert(key in config);
@@ -46,7 +45,7 @@ export function configure(options: ConfigurationOptions = {}): ConfigurationOpti
46
45
  */
47
46
  export function formatValue(
48
47
  value: number,
49
- {precision = config.precision || 4}: ConfigurationOptions = {}
48
+ {precision = config.precision}: {precision?: number} = {}
50
49
  ): string {
51
50
  value = round(value);
52
51
  // get rid of trailing zeros