Skip to content

Commit a3bb38d

Browse files
author
Philipp Alferov
committed
Build assets
1 parent cc74603 commit a3bb38d

File tree

6 files changed

+44
-56
lines changed

6 files changed

+44
-56
lines changed

dist/angular-file-saver.bundle.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -510,32 +510,28 @@ module.exports = function FileSaver(Blob, SaveAs, FileSaverUtils) {
510510
/**
511511
* saveAs - Immediately starts saving a file, returns undefined.
512512
*
513-
* @param {object} config Set of options such as data, filename
514-
* and Blob constructor options. Options - optional parameter if data
515-
* is represented by blob instance
513+
* @param {object} options Set of options such as filename and data.
516514
* @return {undefined}
515+
*
516+
* ##### Params on the `options` object:
517+
* - filename (string): Custom filename (extension is optional).
518+
* - data (Blob): A Blob instance.
517519
*/
518520

519-
saveAs: function(config) {
520-
config = config || {};
521-
var data = config.data;
522-
var filename = config.filename;
523-
var options = config.options;
521+
saveAs: function(options) {
522+
options = angular.extend({}, options);
523+
var data = options.data;
524+
var filename = options.filename;
524525

525-
if (!FileSaverUtils.isArray(data) && !isBlobInstance(data)) {
526-
FileSaverUtils.handleErrors('Data argument should be represented as an array or Blob instance');
526+
if (!isBlobInstance(data)) {
527+
FileSaverUtils.handleErrors('Data argument should be a blob instance');
527528
}
528529

529530
if (!FileSaverUtils.isString(filename)) {
530531
FileSaverUtils.handleErrors('Filename argument should be a string');
531532
}
532533

533-
if (isBlobInstance(data)) {
534-
return save(data, filename);
535-
}
536-
537-
var blob = new Blob(data, options);
538-
return save(blob, filename);
534+
return save(data, filename);
539535
}
540536
};
541537
};

dist/angular-file-saver.bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-file-saver.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +39,28 @@ module.exports = function FileSaver(Blob, SaveAs, FileSaverUtils) {
3939
/**
4040
* saveAs - Immediately starts saving a file, returns undefined.
4141
*
42-
* @param {object} config Set of options such as data, filename
43-
* and Blob constructor options. Options - optional parameter if data
44-
* is represented by blob instance
42+
* @param {object} options Set of options such as filename and data.
4543
* @return {undefined}
44+
*
45+
* ##### Params on the `options` object:
46+
* - filename (string): Custom filename (extension is optional).
47+
* - data (Blob): A Blob instance.
4648
*/
4749

48-
saveAs: function(config) {
49-
config = config || {};
50-
var data = config.data;
51-
var filename = config.filename;
52-
var options = config.options;
50+
saveAs: function(options) {
51+
options = angular.extend({}, options);
52+
var data = options.data;
53+
var filename = options.filename;
5354

54-
if (!FileSaverUtils.isArray(data) && !isBlobInstance(data)) {
55-
FileSaverUtils.handleErrors('Data argument should be represented as an array or Blob instance');
55+
if (!isBlobInstance(data)) {
56+
FileSaverUtils.handleErrors('Data argument should be a blob instance');
5657
}
5758

5859
if (!FileSaverUtils.isString(filename)) {
5960
FileSaverUtils.handleErrors('Filename argument should be a string');
6061
}
6162

62-
if (isBlobInstance(data)) {
63-
return save(data, filename);
64-
}
65-
66-
var blob = new Blob(data, options);
67-
return save(blob, filename);
63+
return save(data, filename);
6864
}
6965
};
7066
};

0 commit comments

Comments
 (0)