Comparing version 3.0.0 to 3.1.0
34
index.js
'use strict'; | ||
var path = require('path'); | ||
var pathExists = require('path-exists'); | ||
if (process.platform === 'darwin') { | ||
module.exports = require('osx-trash'); | ||
} else if (process.platform === 'win32') { | ||
module.exports = require('win-trash'); | ||
} else { | ||
module.exports = require('xdg-trash'); | ||
} | ||
module.exports = function (paths) { | ||
if (!Array.isArray(paths)) { | ||
return Promise.reject(new TypeError('Expected an array')); | ||
} | ||
if (paths.length === 0) { | ||
return Promise.resolve(); | ||
} | ||
paths = paths.map(function (x) { | ||
return path.resolve(String(x)); | ||
}).filter(function (x) { | ||
return pathExists.sync(x); | ||
}); | ||
if (process.platform === 'darwin') { | ||
return require('./lib/osx')(paths); | ||
} | ||
if (process.platform === 'win32') { | ||
return require('./lib/win')(paths); | ||
} | ||
return require('./lib/linux')(paths); | ||
}; |
{ | ||
"name": "trash", | ||
"version": "3.0.0", | ||
"description": "Move files and directories to the trash", | ||
"version": "3.1.0", | ||
"description": "Move files and folders to the trash", | ||
"license": "MIT", | ||
@@ -19,3 +19,4 @@ "repository": "sindresorhus/trash", | ||
"files": [ | ||
"index.js" | ||
"index.js", | ||
"lib" | ||
], | ||
@@ -37,12 +38,18 @@ "keywords": [ | ||
"directories", | ||
"folder", | ||
"folders", | ||
"xdg" | ||
], | ||
"dependencies": { | ||
"osx-trash": "^2.0.0", | ||
"win-trash": "^2.0.0", | ||
"xdg-trash": "^2.0.1" | ||
"escape-string-applescript": "^1.0.0", | ||
"fs-extra": "^0.24.0", | ||
"path-exists": "^2.0.0", | ||
"pify": "^2.2.0", | ||
"pinkie-promise": "^1.0.0", | ||
"run-applescript": "^2.0.0", | ||
"uuid": "^2.0.1", | ||
"xdg-trashdir": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"path-exists": "^2.0.0", | ||
"tempfile": "^1.1.1", | ||
@@ -49,0 +56,0 @@ "xo": "*" |
# ![trash](https://cdn.rawgit.com/sindresorhus/trash/1cdbd660976d739eeb45447bb6b62c41ac4a3ecf/media/logo.svg) | ||
> Move files and directories to the trash | ||
> Move files and folders to the trash | ||
@@ -32,9 +32,7 @@ [![Build Status](https://travis-ci.org/sindresorhus/trash.svg?branch=master)](https://travis-ci.org/sindresorhus/trash) | ||
On OS X, [`osx-trash`](https://github.com/sindresorhus/osx-trash) is used. | ||
On OS X, [`osx-trash`](https://github.com/sindresorhus/osx-trash) is used. | ||
On Linux, the [XDG spec](http://standards.freedesktop.org/trash-spec/trashspec-1.0.html) is followed. | ||
On Windows, [`recycle-bin`](https://github.com/sindresorhus/recycle-bin) is used. | ||
On Linux, [`xdg-trash`](https://github.com/kevva/xdg-trash) is used. | ||
On Windows, [`cmdutils`](http://www.maddogsw.com/cmdutils/) is used. | ||
## FAQ | ||
@@ -51,3 +49,3 @@ | ||
- [empty-trash](https://github.com/sindresorhus/empty-trash) - Empty the trash | ||
- [del](https://github.com/sindresorhus/del) - Delete files/folders using globs | ||
- [del](https://github.com/sindresorhus/del) - Delete files and folders using globs | ||
@@ -54,0 +52,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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
33351
3
9
97
8
54
2
2
+ Addedfs-extra@^0.24.0
+ Addedpath-exists@^2.0.0
+ Addedpify@^2.2.0
+ Addedpinkie-promise@^1.0.0
+ Addedrun-applescript@^2.0.0
+ Addeduuid@^2.0.1
+ Addedxdg-trashdir@^2.0.0
+ Addedfs-extra@0.24.0(transitive)
+ Addedpath-exists@2.1.0(transitive)
- Removedosx-trash@^2.0.0
- Removedwin-trash@^2.0.0
- Removedxdg-trash@^2.0.1
- Removedfs-extra@0.18.4(transitive)
- Removedgraceful-fs@3.0.12(transitive)
- Removednatives@1.1.6(transitive)
- Removedosx-trash@2.0.0(transitive)
- Removedwin-trash@2.0.0(transitive)
- Removedxdg-trash@2.0.2(transitive)