Skip to content

Commit f80a87b

Browse files
author
Philipp Alferov
committed
Fix validation
1 parent f2ee707 commit f80a87b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/angular-file-saver.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,16 @@ function SaveAs($window) {
6767
*/
6868

6969
download: function(data, filename, options) {
70-
if (!isArray(data) || !isBlobInstance(data)) {
70+
options = options || {};
71+
72+
if (!isArray(data) && !isBlobInstance(data)) {
7173
handleErrors('Data argument should be represented as an array or Blob instance');
7274
}
7375

7476
if (!isString(filename)) {
7577
handleErrors('Filename argument should be a string');
7678
}
7779

78-
if (!isObject(options)) {
79-
handleErrors('Options argument should be an object');
80-
}
81-
8280
if (isBlobInstance(data)) {
8381
return save(data, filename);
8482
}

0 commit comments

Comments
 (0)