From c194f84cab66fa6e18b78c32f9cdf2bddf8d1e68 Mon Sep 17 00:00:00 2001 From: eric thul Date: Wed, 8 Apr 2015 19:49:24 -0400 Subject: Rewrite using purescript for the implementation --- src/Path.purs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/Path.purs (limited to 'src/Path.purs') 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 @@ +module PursLoader.Path + ( dirname + , join + , relative + , resolve + ) where + +foreign import dirname """ +function dirname(filepath) { + var path = require('path'); + return path.dirname(filepath); +} +""" :: String -> String + +foreign import join """ +function join(parts) { + var path = require('path'); + return path.join.apply(path, parts); +} +""" :: [String] -> String + +foreign import relative """ +function relative(from) { + return function(to){ + var path = require('path'); + return path.relative(from, to); + }; +} +""" :: String -> String -> String + +foreign import resolve """ +function resolve(filepath) { + var path = require('path'); + return path.resolve(filepath); +} +""" :: String -> String -- cgit v1.2.3