@woosh/meep-engine 2.121.5 → 2.121.7
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/package.json +1 -1
- package/src/core/math/frexp.d.ts +2 -1
- package/src/core/math/frexp.d.ts.map +1 -1
- package/src/core/math/frexp.js +4 -3
- package/src/core/path/computeFileExtension.d.ts.map +1 -1
- package/src/core/path/computeFileExtension.js +3 -4
- package/src/core/path/computeFileName.d.ts +12 -0
- package/src/core/path/computeFileName.d.ts.map +1 -0
- package/src/core/path/computeFileName.js +24 -0
package/package.json
CHANGED
package/src/core/math/frexp.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Similar to C's frexp function.
|
|
4
4
|
* @param {number} value - The floating-point number to decompose
|
|
5
5
|
* @param {number[]} exponent where to write exponent to
|
|
6
|
+
* @param {number} [offset_into_exponent]
|
|
6
7
|
* @returns {number} mantissa
|
|
7
8
|
*/
|
|
8
|
-
export function frexp(value: number, exponent: number[]): number;
|
|
9
|
+
export function frexp(value: number, exponent: number[], offset_into_exponent?: number): number;
|
|
9
10
|
//# sourceMappingURL=frexp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frexp.d.ts","sourceRoot":"","sources":["../../../../src/core/math/frexp.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"frexp.d.ts","sourceRoot":"","sources":["../../../../src/core/math/frexp.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,6BALW,MAAM,YACN,MAAM,EAAE,yBACR,MAAM,GACJ,MAAM,CAqClB"}
|
package/src/core/math/frexp.js
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* Similar to C's frexp function.
|
|
4
4
|
* @param {number} value - The floating-point number to decompose
|
|
5
5
|
* @param {number[]} exponent where to write exponent to
|
|
6
|
+
* @param {number} [offset_into_exponent]
|
|
6
7
|
* @returns {number} mantissa
|
|
7
8
|
*/
|
|
8
|
-
export function frexp(value, exponent) {
|
|
9
|
+
export function frexp(value, exponent, offset_into_exponent = 0) {
|
|
9
10
|
if (value === 0 || Number.isFinite(value) === false) {
|
|
10
|
-
exponent[
|
|
11
|
+
exponent[offset_into_exponent] = 0;
|
|
11
12
|
return value;
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -37,7 +38,7 @@ export function frexp(value, exponent) {
|
|
|
37
38
|
mantissa = -mantissa;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
exponent[
|
|
41
|
+
exponent[offset_into_exponent] = exp;
|
|
41
42
|
|
|
42
43
|
return mantissa;
|
|
43
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeFileExtension.d.ts","sourceRoot":"","sources":["../../../../src/core/path/computeFileExtension.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,2CAHW,MAAM,GACJ,SAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"computeFileExtension.d.ts","sourceRoot":"","sources":["../../../../src/core/path/computeFileExtension.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,2CAHW,MAAM,GACJ,SAAO,IAAI,CAkBvB"}
|
|
@@ -11,13 +11,12 @@ export function computeFileExtension(path) {
|
|
|
11
11
|
throw new Error(`path must be a string, instead was '${type_of_path}'`);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
const pathBase = computePathBase(path);
|
|
14
|
+
const base = computePathBase(path);
|
|
16
15
|
|
|
17
|
-
const lastDotIndex =
|
|
16
|
+
const lastDotIndex = base.lastIndexOf('.');
|
|
18
17
|
|
|
19
18
|
if (lastDotIndex !== -1) {
|
|
20
|
-
return
|
|
19
|
+
return base.substring(lastDotIndex + 1);
|
|
21
20
|
} else {
|
|
22
21
|
//no extension
|
|
23
22
|
return null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get name of a file from a given path
|
|
3
|
+
* @param {string} path
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* 'a/b/c.txt' -> 'c'
|
|
8
|
+
* 'hello.txt' -> 'hello'
|
|
9
|
+
* 'http://meep.com/index.html' -> 'index'
|
|
10
|
+
*/
|
|
11
|
+
export function computeFileName(path: string): string;
|
|
12
|
+
//# sourceMappingURL=computeFileName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeFileName.d.ts","sourceRoot":"","sources":["../../../../src/core/path/computeFileName.js"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,sCARW,MAAM,GACJ,MAAM,CAkBlB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { computePathBase } from "./computePathBase.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get name of a file from a given path
|
|
5
|
+
* @param {string} path
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* 'a/b/c.txt' -> 'c'
|
|
10
|
+
* 'hello.txt' -> 'hello'
|
|
11
|
+
* 'http://meep.com/index.html' -> 'index'
|
|
12
|
+
*/
|
|
13
|
+
export function computeFileName(path) {
|
|
14
|
+
const base = computePathBase(path);
|
|
15
|
+
|
|
16
|
+
const lastDotIndex = base.lastIndexOf('.');
|
|
17
|
+
|
|
18
|
+
if (lastDotIndex !== -1) {
|
|
19
|
+
return base.substring(0, lastDotIndex);
|
|
20
|
+
} else {
|
|
21
|
+
//no extension
|
|
22
|
+
return base;
|
|
23
|
+
}
|
|
24
|
+
}
|