@raruto/leaflet-elevation 2.1.1 → 2.2.0

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/spec/mock.js DELETED
@@ -1,26 +0,0 @@
1
- import { JSDOM } from 'jsdom';
2
-
3
- const { window } = new JSDOM('<main></main>');
4
-
5
- global.window = window;
6
- global.document = window.document;
7
- global.navigator = window.navigator;
8
- global.getComputedStyle = window.getComputedStyle;
9
- global.requestAnimationFrame = null;
10
-
11
- global.L = {
12
- DomEvent: {
13
- on: () => {},
14
- off: () => {}
15
- },
16
- Util: {
17
- throttle: () => {},
18
- wrapNum: () => {},
19
- formatNum: () => {}
20
- },
21
- DomUtil: {
22
- hasClass: () => {}
23
- }
24
- };
25
-
26
-
package/spec/mock.min.js DELETED
@@ -1 +0,0 @@
1
- import{JSDOM}from"jsdom";const{window:window}=new JSDOM("<main></main>");global.window=window,global.document=window.document,global.navigator=window.navigator,global.getComputedStyle=window.getComputedStyle,global.requestAnimationFrame=null,global.L={DomEvent:{on:()=>{},off:()=>{}},Util:{throttle:()=>{},wrapNum:()=>{},formatNum:()=>{}},DomUtil:{hasClass:()=>{}}};
@@ -1,41 +0,0 @@
1
- import { suite } from 'uvu';
2
- import * as assert from 'uvu/assert';
3
- import { iAvg, iMin, iMax, iSum } from "../src/utils.js";
4
-
5
- const toFixed = (n) => +n.toFixed(2);
6
-
7
- const test = suite('stats');
8
-
9
- test('iAvg()', () => {
10
- let avg;
11
- avg = iAvg(100, undefined, 1); assert.is(toFixed(avg), 100); // average for [100] is 100
12
- avg = iAvg(100, avg, 2); assert.is(toFixed(avg), 100); // average for [100, 100] is 100
13
- avg = iAvg(200, avg, 3); assert.is(toFixed(avg), 133.33); // average for [100, 100, 200] is 133.33
14
- avg = iAvg(200, avg, 4); assert.is(toFixed(avg), 150); // average for [100, 100, 200, 200] is 150
15
- });
16
-
17
- test('iMin()', () => {
18
- let min;
19
- min = iMin(100, undefined); assert.is(toFixed(min), 100); // min for [100] is 100
20
- min = iMin(0, min); assert.is(toFixed(min), 0); // min for [100, 0] is 100
21
- min = iMin(-200, min); assert.is(toFixed(min), -200); // min for [100, 0, -200] is -200
22
- min = iMin(200, min); assert.is(toFixed(min), -200); // min for [100, -100, -200, 200] is -200
23
- });
24
-
25
- test('iMax()', () => {
26
- let max;
27
- max = iMax(100, undefined); assert.is(toFixed(max), 100); // max for [100] is 100
28
- max = iMax(0, max); assert.is(toFixed(max), 100); // max for [100, 0] is 100
29
- max = iMax(-200, max); assert.is(toFixed(max), 100); // max for [100, 0, -200] is 100
30
- max = iMax(200, max); assert.is(toFixed(max), 200); // max for [100, -100, -200, 200] is 200
31
- });
32
-
33
- test('iSum()', () => {
34
- let sum;
35
- sum = iSum(10.25, undefined); assert.is(toFixed(sum), 10.25); // sum for [10.25] is 10.25
36
- sum = iSum(0, sum); assert.is(toFixed(sum), 10.25); // sum for [10.25, 0] is 10.25
37
- sum = iSum(-0.25, sum); assert.is(toFixed(sum), 10); // sum for [100, 0, -0.25] is 10
38
- sum = iSum(-10, sum); assert.is(toFixed(sum), 0); // sum for [100, 0, -0.25, -10] is 0
39
- });
40
-
41
- test.run();
@@ -1 +0,0 @@
1
- import{suite}from"uvu";import*as assert from"uvu/assert";import{iAvg,iMin,iMax,iSum}from"../src/utils.js";const toFixed=n=>+n.toFixed(2),test=suite("stats");test("iAvg()",()=>{let avg;avg=iAvg(100,void 0,1),assert.is(toFixed(avg),100),avg=iAvg(100,avg,2),assert.is(toFixed(avg),100),avg=iAvg(200,avg,3),assert.is(toFixed(avg),133.33),avg=iAvg(200,avg,4),assert.is(toFixed(avg),150)}),test("iMin()",()=>{let min;min=iMin(100,void 0),assert.is(toFixed(min),100),min=iMin(0,min),assert.is(toFixed(min),0),min=iMin(-200,min),assert.is(toFixed(min),-200),min=iMin(200,min),assert.is(toFixed(min),-200)}),test("iMax()",()=>{let max;max=iMax(100,void 0),assert.is(toFixed(max),100),max=iMax(0,max),assert.is(toFixed(max),100),max=iMax(-200,max),assert.is(toFixed(max),100),max=iMax(200,max),assert.is(toFixed(max),200)}),test("iSum()",()=>{let sum;sum=iSum(10.25,void 0),assert.is(toFixed(sum),10.25),sum=iSum(0,sum),assert.is(toFixed(sum),10.25),sum=iSum(-.25,sum),assert.is(toFixed(sum),10),sum=iSum(-10,sum),assert.is(toFixed(sum),0)}),test.run();