Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

afile

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

afile - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

18

index.js

@@ -22,3 +22,3 @@ 'use strict';

module.exports = function (targets, cb) {
function afile(targets, cb) {
if (!Array.isArray(targets)) {

@@ -28,3 +28,17 @@ targets = [targets];

findone(targets, cb);
findone(targets.slice(0), cb);
}
module.exports = function (targets) {
return new Promise(function (resolve, reject) {
afile(targets, function (f) {
if (f) {
resolve(f);
} else {
reject(new Error('Not found a file'));
}
});
});
};
module.exports.cb = afile;

4

package.json
{
"name": "afile",
"version": "0.2.0",
"version": "0.3.0",
"description": "Find a file on the list",

@@ -16,3 +16,3 @@ "license": "MIT",

"scripts": {
"test": "xo && ava"
"test": "xo && ava --verbose"
},

@@ -19,0 +19,0 @@ "files": [

# afile [![Build Status](https://travis-ci.org/ragingwind/afile.svg?branch=master)](https://travis-ci.org/ragingwind/afile)
> Find a file on the list
> Find a file in the list

@@ -25,12 +25,30 @@

afile(targets, afilepath => {
// promise supports
afile(targets).then(function (f) {
console.log(f);
//=> /home/yours/.bowerrc
}, function () {
// not in the list
});
// callback style
afile(targets, f => {
console.log(f);
//=> /home/yours/.bowerrc
});
```
## API
### afile(tagets, cb);
### afile(tagets)
return promise, will resolve if target file is exist.
### afile.cb(tagets, cb)
callback style, will pass with target file or not.
## License
MIT © [Jimmy Moon](http://ragingwind.me)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc