diff options
author | eric <thul.eric@gmail.com> | 2015-04-12 11:35:25 -0400 |
---|---|---|
committer | eric <thul.eric@gmail.com> | 2015-04-12 11:35:25 -0400 |
commit | 7d58cf78c770ef95858f90c6e89bd18653657a82 (patch) | |
tree | ebae7549b1a1b14e11fd5e2ad4dd66d901af81c8 /src/Path.purs | |
parent | 18ced1e0f031df444a5d85d72cd6843d826fef38 (diff) | |
parent | 94a23e744896b4440794de5d6cffedff1a1a2d56 (diff) | |
download | purs-loader-7d58cf78c770ef95858f90c6e89bd18653657a82.tar.gz purs-loader-7d58cf78c770ef95858f90c6e89bd18653657a82.tar.zst purs-loader-7d58cf78c770ef95858f90c6e89bd18653657a82.zip |
Merge pull request #8 from ethul/topic/purescript-rewrite
Topic/purescript rewrite
Diffstat (limited to 'src/Path.purs')
-rw-r--r-- | src/Path.purs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Path.purs b/src/Path.purs new file mode 100644 index 0000000..e071e35 --- /dev/null +++ b/src/Path.purs | |||
@@ -0,0 +1,36 @@ | |||
1 | module PursLoader.Path | ||
2 | ( dirname | ||
3 | , join | ||
4 | , relative | ||
5 | , resolve | ||
6 | ) where | ||
7 | |||
8 | foreign import dirname """ | ||
9 | function dirname(filepath) { | ||
10 | var path = require('path'); | ||
11 | return path.dirname(filepath); | ||
12 | } | ||
13 | """ :: String -> String | ||
14 | |||
15 | foreign import join """ | ||
16 | function join(parts) { | ||
17 | var path = require('path'); | ||
18 | return path.join.apply(path, parts); | ||
19 | } | ||
20 | """ :: [String] -> String | ||
21 | |||
22 | foreign import relative """ | ||
23 | function relative(from) { | ||
24 | return function(to){ | ||
25 | var path = require('path'); | ||
26 | return path.relative(from, to); | ||
27 | }; | ||
28 | } | ||
29 | """ :: String -> String -> String | ||
30 | |||
31 | foreign import resolve """ | ||
32 | function resolve(filepath) { | ||
33 | var path = require('path'); | ||
34 | return path.resolve(filepath); | ||
35 | } | ||
36 | """ :: String -> String | ||