Skip to content

Commit aa29749

Browse files
committedNov 6, 2018
Drop support for Iterable as input
It makes more sense to be explicit and only support string or array. You can easily use an iterable by spreading anyway.
1 parent 6cd7609 commit aa29749

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed
 

‎.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ os:
33
- osx
44
language: node_js
55
node_js:
6+
- '11'
67
- '10'
78
- '8'

‎index.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,24 @@ const macos = require('./lib/macos');
77
const linux = require('./lib/linux');
88
const windows = require('./lib/windows');
99

10-
module.exports = (iterable, options) => pTry(() => {
11-
iterable = [...(typeof iterable === 'string' ? [iterable] : iterable)].map(String);
10+
module.exports = (paths, options) => pTry(() => {
11+
paths = (typeof paths === 'string' ? [paths] : paths).map(String);
1212

1313
options = {
1414
glob: true,
1515
...options
1616
};
1717

1818
// TOOD: Upgrading to latest `globby` version is blocked by https://github.com/mrmlnc/fast-glob/issues/110
19-
const paths = (options.glob === false ? iterable : globby.sync(iterable, {
20-
expandDirectories: false,
21-
nodir: false,
22-
nonull: true
23-
}))
19+
if (options.glob) {
20+
paths = globby.sync(paths, {
21+
expandDirectories: false,
22+
nodir: false,
23+
nonull: true
24+
});
25+
}
26+
27+
paths = paths
2428
.map(filePath => path.resolve(filePath))
2529
.filter(filePath => {
2630
try {

‎readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Move files and folders to the trash
44
5-
[![Build Status](https://travis-ci.org/sindresorhus/trash.svg?branch=master)](https://travis-ci.org/sindresorhus/trash)
5+
[![Build Status](https://travis-ci.com/sindresorhus/trash.svg?branch=master)](https://travis-ci.com/sindresorhus/trash)
66

77
Works on macOS, Linux, and Windows.
88

@@ -35,7 +35,7 @@ Returns a `Promise`.
3535

3636
#### input
3737

38-
Type: `Iterable<string>`
38+
Type: `string` `string[]`
3939

4040
Accepts paths and [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
4141

0 commit comments

Comments
 (0)
Please sign in to comment.