@woosh/meep-engine 2.121.6 → 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 CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.121.6",
8
+ "version": "2.121.7",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -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,CAmBvB"}
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
- //get base
15
- const pathBase = computePathBase(path);
14
+ const base = computePathBase(path);
16
15
 
17
- const lastDotIndex = pathBase.lastIndexOf('.');
16
+ const lastDotIndex = base.lastIndexOf('.');
18
17
 
19
18
  if (lastDotIndex !== -1) {
20
- return pathBase.substring(lastDotIndex + 1);
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
+ }