Comparing version
@@ -12,3 +12,3 @@ 'use strict'; | ||
const trash = (paths, options) => pTry(() => { | ||
paths = (typeof paths === 'string' ? [paths] : paths).map(String); | ||
paths = (typeof paths === 'string' ? [paths] : paths).map(path => String(path)); | ||
@@ -20,3 +20,3 @@ options = { | ||
// TOOD: Upgrading to latest `globby` version is blocked by https://github.com/mrmlnc/fast-glob/issues/110 | ||
// TODO: Upgrading to latest `globby` version is blocked by https://github.com/mrmlnc/fast-glob/issues/110 | ||
if (options.glob) { | ||
@@ -31,2 +31,3 @@ paths = globby.sync(paths, { | ||
paths = paths.map(filePath => path.resolve(filePath)); | ||
paths = paths.filter(filePath => { | ||
@@ -33,0 +34,0 @@ if (paths.some(otherPath => isPathInside(filePath, otherPath))) { |
{ | ||
"name": "trash", | ||
"version": "6.1.1", | ||
"version": "7.0.0", | ||
"description": "Move files and folders to the trash", | ||
"license": "MIT", | ||
"repository": "sindresorhus/trash", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=10" | ||
}, | ||
@@ -42,11 +43,11 @@ "scripts": { | ||
"dependencies": { | ||
"@stroncium/procfs": "^1.0.0", | ||
"@stroncium/procfs": "^1.2.1", | ||
"globby": "^7.1.1", | ||
"is-path-inside": "^3.0.2", | ||
"make-dir": "^3.0.0", | ||
"move-file": "^1.1.0", | ||
"p-map": "^3.0.0", | ||
"make-dir": "^3.1.0", | ||
"move-file": "^2.0.0", | ||
"p-map": "^4.0.0", | ||
"p-try": "^2.2.0", | ||
"uuid": "^3.3.2", | ||
"xdg-trashdir": "^2.1.1" | ||
"uuid": "^8.3.1", | ||
"xdg-trashdir": "^3.1.0" | ||
}, | ||
@@ -56,5 +57,5 @@ "devDependencies": { | ||
"tempfile": "^3.0.0", | ||
"tsd": "^0.11.0", | ||
"xo": "^0.25.3" | ||
"tsd": "^0.13.1", | ||
"xo": "^0.35.0" | ||
} | ||
} |
@@ -5,9 +5,10 @@ #  | ||
[](https://travis-ci.org/sindresorhus/trash) | ||
[](https://travis-ci.com/github/sindresorhus/trash) | ||
Works on macOS (10.12+), Linux, and Windows (8+). | ||
**Note:** The Linux implementation is not very good and not maintained. Help welcome. If no one steps up to help maintain it, I will eventually remove Linux support. | ||
In contrast to [`fs.unlink`](https://nodejs.org/api/fs.html#fs_fs_unlink_path_callback), [`del`](https://github.com/sindresorhus/del), and [`rimraf`](https://github.com/isaacs/rimraf) which permanently delete files, this only moves them to the trash, which is much safer and reversible. | ||
## Install | ||
@@ -19,3 +20,2 @@ | ||
## Usage | ||
@@ -31,6 +31,5 @@ | ||
## API | ||
### trash(input, [options]) | ||
### trash(input, options?) | ||
@@ -41,3 +40,3 @@ Returns a `Promise`. | ||
Type: `string` `string[]` | ||
Type: `string | string[]` | ||
@@ -48,7 +47,7 @@ Accepts paths and [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). | ||
Type: `Object` | ||
Type: `object` | ||
##### glob | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -58,3 +57,2 @@ | ||
## CLI | ||
@@ -68,10 +66,8 @@ | ||
## Info | ||
On macOS, [`macos-trash`](https://github.com/sindresorhus/macos-trash) is used.<br> | ||
On Linux, the [XDG spec](http://standards.freedesktop.org/trash-spec/trashspec-1.0.html) is followed.<br> | ||
On macOS, [`macos-trash`](https://github.com/sindresorhus/macos-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. | ||
## FAQ | ||
@@ -83,3 +79,2 @@ | ||
## Related | ||
@@ -90,6 +85,1 @@ | ||
- [del](https://github.com/sindresorhus/del) - Delete files and folders | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
53639
0.34%77
-11.49%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated
Updated