1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-11 01:58:05 -05:00

path: remove export = module (#95)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2019-01-07 07:39:36 -08:00 committed by Ryan Dahl
parent 2606e295c7
commit a0b5aec823
2 changed files with 18 additions and 5 deletions

View file

@ -119,7 +119,7 @@ function _format(sep: string, pathObject: FormatInputPathObject) {
return dir + sep + base; return dir + sep + base;
} }
const win32 = { export const win32 = {
// path.resolve([from ...], to) // path.resolve([from ...], to)
resolve: function resolve(...pathSegments: string[]) { resolve: function resolve(...pathSegments: string[]) {
let resolvedDevice = ""; let resolvedDevice = "";
@ -1004,7 +1004,7 @@ const win32 = {
posix: null posix: null
}; };
const posix = { export const posix = {
// path.resolve([from ...], to) // path.resolve([from ...], to)
resolve: function resolve(...pathSegments: string[]) { resolve: function resolve(...pathSegments: string[]) {
let resolvedPath = ""; let resolvedPath = "";
@ -1422,4 +1422,17 @@ posix.win32 = win32.win32 = win32;
posix.posix = win32.posix = posix; posix.posix = win32.posix = posix;
const module = platform.os === "win" ? win32 : posix; const module = platform.os === "win" ? win32 : posix;
export = module;
export const resolve = module.resolve;
export const normalize = module.normalize;
export const isAbsolute = module.isAbsolute;
export const join = module.join;
export const relative = module.relative;
export const toNamespacedPath = module.toNamespacedPath;
export const dirname = module.dirname;
export const basename = module.basename;
export const extname = module.extname;
export const format = module.format;
export const parse = module.parse;
export const sep = module.sep;
export const delimiter = module.delimiter;

View file

@ -161,7 +161,7 @@ function checkFormat(path, testCases) {
test(function parseTrailingWin32() { test(function parseTrailingWin32() {
windowsTrailingTests.forEach(function(p) { windowsTrailingTests.forEach(function(p) {
const actual = path.win32.parse(p[0]); const actual = path.win32.parse(p[0] as string);
const expected = p[1]; const expected = p[1];
assertEqual(actual, expected); assertEqual(actual, expected);
}); });
@ -169,7 +169,7 @@ test(function parseTrailingWin32() {
test(function parseTrailing() { test(function parseTrailing() {
posixTrailingTests.forEach(function(p) { posixTrailingTests.forEach(function(p) {
const actual = path.posix.parse(p[0]); const actual = path.posix.parse(p[0] as string);
const expected = p[1]; const expected = p[1];
assertEqual(actual, expected); assertEqual(actual, expected);
}); });