@jdeighan/coffee-utils 4.0.17 → 4.0.18
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/fs_utils.coffee +9 -0
- package/src/fs_utils.js +10 -0
package/package.json
CHANGED
package/src/fs_utils.coffee
CHANGED
@@ -30,6 +30,15 @@ export isSimpleFileName = (path) ->
|
|
30
30
|
h = pathlib.parse(path)
|
31
31
|
return ! h.root && ! h.dir && h.base
|
32
32
|
|
33
|
+
# ---------------------------------------------------------------------------
|
34
|
+
|
35
|
+
export fileExt = (path) ->
|
36
|
+
|
37
|
+
if lMatches = path.match(/\.[A-Za-z0-9_]+$/)
|
38
|
+
return lMatches[0]
|
39
|
+
else
|
40
|
+
return ''
|
41
|
+
|
33
42
|
# ---------------------------------------------------------------------------
|
34
43
|
# mydir() - pass argument `import.meta.url` and it will return
|
35
44
|
# the directory your file is in
|
package/src/fs_utils.js
CHANGED
@@ -45,6 +45,16 @@ export var isSimpleFileName = function(path) {
|
|
45
45
|
return !h.root && !h.dir && h.base;
|
46
46
|
};
|
47
47
|
|
48
|
+
// ---------------------------------------------------------------------------
|
49
|
+
export var fileExt = function(path) {
|
50
|
+
var lMatches;
|
51
|
+
if (lMatches = path.match(/\.[A-Za-z0-9_]+$/)) {
|
52
|
+
return lMatches[0];
|
53
|
+
} else {
|
54
|
+
return '';
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
48
58
|
// ---------------------------------------------------------------------------
|
49
59
|
// mydir() - pass argument `import.meta.url` and it will return
|
50
60
|
// the directory your file is in
|