From 9038685da2b0a34303ac5a94c6a11c1c3157284f Mon Sep 17 00:00:00 2001 From: DuanPengfei <2459714173@qq.com> Date: Fri, 16 Jun 2017 11:19:16 +0800 Subject: [PATCH 1/2] doc: make `path.relative` stricter think of this situation: you are current under root path and you do ``` path.relative('../../../../../x', '../../y'); ``` `path.relative` can't fictitious a path for the result, so it's based on current working directory. --- doc/api/path.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/path.md b/doc/api/path.md index 34963ae5eb3ebd..540e1389aaaf74 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -445,9 +445,9 @@ changes: * `to` {string} * Returns: {string} -The `path.relative()` method returns the relative path from `from` to `to`. -If `from` and `to` each resolve to the same path (after calling `path.resolve()` -on each), a zero-length string is returned. +The `path.relative()` method returns the relative path from `from` to `to` based +on current working directory. If `from` and `to` each resolve to the same path +(after calling `path.resolve()` on each), a zero-length string is returned. If a zero-length string is passed as `from` or `to`, the current working directory will be used instead of the zero-length strings. From 0032aeac30337edf7fb6bf519f204f51a0f915de Mon Sep 17 00:00:00 2001 From: DuanPengfei <2459714173@qq.com> Date: Fri, 16 Jun 2017 13:58:37 +0800 Subject: [PATCH 2/2] doc: modify the grammer --- doc/api/path.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/path.md b/doc/api/path.md index 540e1389aaaf74..a5c5af6d068704 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -446,8 +446,8 @@ changes: * Returns: {string} The `path.relative()` method returns the relative path from `from` to `to` based -on current working directory. If `from` and `to` each resolve to the same path -(after calling `path.resolve()` on each), a zero-length string is returned. +on the current working directory. If `from` and `to` each resolve to the same +path (after calling `path.resolve()` on each), a zero-length string is returned. If a zero-length string is passed as `from` or `to`, the current working directory will be used instead of the zero-length strings.