🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

noda

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

noda - npm Package Compare versions

Comparing version
0.1.1
to
0.1.2
+4
-2
CHANGELOG.md

@@ -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 @@

@@ -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 @@ };

{
"name": "noda",
"version": "0.1.1",
"version": "0.1.2",
"description": "NOde Developing Assistant",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -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