+4
-2
@@ -5,6 +5,8 @@ # noda Change Log | ||
| ## [0.1.2] - 2017-11-20 | ||
| * `noda.inExists(subpath)` is extended to `noda.inExists(subpath, resolveAsModule)`. Of course, the extended parameter __resolveAsModule__ is set false by default. | ||
| ## [0.1.1] - 2017-11-05 | ||
| ### Changed | ||
| * For `noda.requireDir()` and `noda.inRequireDir()`, d irectory "node_modules" is always ignored whether or not it is explictly added in `ignores`. | ||
@@ -11,0 +13,0 @@ |
+19
-2
@@ -38,5 +38,10 @@ /** | ||
| * @param {string} subpath path relative to the homedir of current package | ||
| * @param {boolean} resolveAsModule try to resolve the subpath as it is a module | ||
| * @return {boolean} | ||
| */ | ||
| let inExists = function(subpath) { | ||
| let inExists = function(subpath, resolveAsModule) { | ||
| if (arguments.length == 1) { | ||
| resolveAsModule = false; | ||
| } | ||
| // Find home directory of the package in which the caller is located. | ||
@@ -46,3 +51,15 @@ let dirname = getCallerPackageDir(); | ||
| let ret = fs.existsSync(pathname); | ||
| let ret; | ||
| if (resolveAsModule) { | ||
| ret = fs.existsSync(pathname) | ||
| || fs.existsSync(`${pathname}.js`) | ||
| || fs.existsSync(`${pathname}.json`) | ||
| || fs.existsSync(path.join(pathname, 'index.js')) | ||
| || fs.existsSync(path.join(pathname, 'index.json')) | ||
| ; | ||
| } | ||
| else { | ||
| ret = fs.existsSync(pathname); | ||
| } | ||
| return ret; | ||
@@ -49,0 +66,0 @@ }; |
+1
-1
| { | ||
| "name": "noda", | ||
| "version": "0.1.1", | ||
| "version": "0.1.2", | ||
| "description": "NOde Developing Assistant", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+3
-3
@@ -45,4 +45,4 @@ # noda | ||
| * __noda.inExists__(*string* subpath) | ||
| Judge whether file or directory exists. | ||
| * __noda.inExists__(*string* subpath, *boolean* resolveAsModule) | ||
| Judge whether file or directory exists. If __resolveAsModule__ set `true`, __subpath__ will be tentatively regarded as JS/JSON module path in the current package when the exact file not exists. | ||
| This method is __synchronuous__. | ||
@@ -90,3 +90,3 @@ | ||
| ``` | ||
| ```code | ||
| + ching | ||
@@ -93,0 +93,0 @@ + bin |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
13432
7.03%253
6.3%1
Infinity%