Comparing version 0.3.2 to 1.0.0
30
index.js
'use strict'; | ||
var fs = require('fs'); | ||
const fs = require('fs'); | ||
@@ -30,20 +30,4 @@ function arrify(a) { | ||
function findoneSync(targets) { | ||
for (var i = 0; i < targets.length; ++i) { | ||
try { | ||
if (fs.statSync(targets[i]).isFile()) { | ||
return targets[i]; | ||
} | ||
} catch (e) {} | ||
} | ||
return null; | ||
} | ||
function afile(targets, cb) { | ||
if (cb) { | ||
return findone(arrify(targets), cb); | ||
} | ||
return findoneSync(arrify(targets)); | ||
return findone(arrify(targets), cb); | ||
} | ||
@@ -53,12 +37,6 @@ | ||
return new Promise(function (resolve, reject) { | ||
afile(targets, function (f) { | ||
if (f) { | ||
resolve(f); | ||
} else { | ||
reject(new Error('Not found a file')); | ||
} | ||
afile(targets, f => { | ||
return f ? resolve(f) : reject(new Error('Not found a file')); | ||
}); | ||
}); | ||
}; | ||
module.exports.cb = module.exports.sync = afile; |
{ | ||
"name": "afile", | ||
"version": "0.3.2", | ||
"version": "1.0.0", | ||
"description": "Find a file on the list", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=0.4.0" | ||
"node": ">=0.6.0" | ||
}, | ||
@@ -29,5 +29,5 @@ "scripts": { | ||
"devDependencies": { | ||
"ava": "^0.9.1", | ||
"xo": "^0.12.1" | ||
"ava": "^0.15.2", | ||
"xo": "^0.16.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
3275
33