Comparing version 4.0.1 to 4.1.0
12
index.js
'use strict'; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const pathExists = require('path-exists'); | ||
const globby = require('globby'); | ||
@@ -9,7 +9,9 @@ const macos = require('./lib/macos'); | ||
module.exports = iterable => { | ||
iterable = typeof iterable === 'string' ? [iterable] : iterable; | ||
const paths = globby.sync(Array.from(iterable).map(String), {nonull: true}) | ||
module.exports = (iterable, opts) => { | ||
iterable = Array.from(typeof iterable === 'string' ? [iterable] : iterable).map(String); | ||
opts = Object.assign({glob: true}, opts); | ||
const paths = (opts.glob === false ? iterable : globby.sync(iterable, {nonull: true})) | ||
.map(x => path.resolve(x)) | ||
.filter(pathExists.sync); | ||
.filter(fs.existsSync); | ||
@@ -16,0 +18,0 @@ if (paths.length === 0) { |
@@ -11,3 +11,3 @@ 'use strict'; | ||
// binary source: https://github.com/sindresorhus/macos-trash | ||
// Binary source: https://github.com/sindresorhus/macos-trash | ||
const bin = path.join(__dirname, 'macos-trash'); | ||
@@ -14,0 +14,0 @@ |
@@ -6,5 +6,5 @@ 'use strict'; | ||
// binary source: https://github.com/sindresorhus/recycle-bin | ||
// Binary source: https://github.com/sindresorhus/recycle-bin | ||
const bin = path.join(__dirname, 'win-trash.exe'); | ||
module.exports = paths => pify(execFile)(bin, paths); |
110
package.json
{ | ||
"name": "trash", | ||
"version": "4.0.1", | ||
"description": "Move files and folders to the trash", | ||
"license": "MIT", | ||
"repository": "sindresorhus/trash", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"lib" | ||
], | ||
"keywords": [ | ||
"trash", | ||
"recycle", | ||
"bin", | ||
"rm", | ||
"rmrf", | ||
"rimraf", | ||
"remove", | ||
"delete", | ||
"del", | ||
"file", | ||
"files", | ||
"dir", | ||
"directory", | ||
"directories", | ||
"folder", | ||
"folders", | ||
"xdg" | ||
], | ||
"dependencies": { | ||
"escape-string-applescript": "^1.0.0", | ||
"fs-extra": "^0.30.0", | ||
"globby": "^6.0.0", | ||
"path-exists": "^3.0.0", | ||
"pify": "^2.3.0", | ||
"run-applescript": "^3.0.0", | ||
"uuid": "^2.0.1", | ||
"xdg-trashdir": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"tempfile": "^1.1.1", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
"name": "trash", | ||
"version": "4.1.0", | ||
"description": "Move files and folders to the trash", | ||
"license": "MIT", | ||
"repository": "sindresorhus/trash", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"lib" | ||
], | ||
"keywords": [ | ||
"trash", | ||
"recycle", | ||
"bin", | ||
"rm", | ||
"rmrf", | ||
"rimraf", | ||
"remove", | ||
"delete", | ||
"del", | ||
"file", | ||
"files", | ||
"dir", | ||
"directory", | ||
"directories", | ||
"folder", | ||
"folders", | ||
"xdg" | ||
], | ||
"dependencies": { | ||
"escape-string-applescript": "^2.0.0", | ||
"fs-extra": "^0.30.0", | ||
"globby": "^6.0.0", | ||
"pify": "^3.0.0", | ||
"run-applescript": "^3.0.0", | ||
"uuid": "^3.1.0", | ||
"xdg-trashdir": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"tempfile": "^2.0.0", | ||
"xo": "*" | ||
} | ||
} |
@@ -15,3 +15,3 @@ # ![trash](https://cdn.rawgit.com/sindresorhus/trash/1cdbd660976d739eeb45447bb6b62c41ac4a3ecf/media/logo.svg) | ||
``` | ||
$ npm install --save trash | ||
$ npm install trash | ||
``` | ||
@@ -30,5 +30,6 @@ | ||
## API | ||
### trash(input) | ||
### trash(input, [options]) | ||
@@ -43,3 +44,14 @@ Returns a `Promise`. | ||
#### options | ||
Type: `Object` | ||
##### glob | ||
Type: `boolean`<br> | ||
Default: `true` | ||
Enable globbing when matching file paths. | ||
## CLI | ||
@@ -46,0 +58,0 @@ |
Sorry, the diff of this file is not supported yet
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
33894
7
88
87
3
+ Addedescape-string-applescript@2.0.0(transitive)
+ Addedpify@3.0.0(transitive)
+ Addeduuid@3.4.0(transitive)
- Removedpath-exists@^3.0.0
- Removedescape-string-applescript@1.0.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removeduuid@2.0.3(transitive)
Updatedpify@^3.0.0
Updateduuid@^3.1.0