1
1
import dateformat from 'dateformat' ;
2
- import assign from 'object-assign' ;
3
2
import padLeft from 'pad-left' ;
4
3
import { getClientAPI } from './util' ;
5
4
@@ -21,15 +20,15 @@ const supportedEncodings = [
21
20
22
21
function stream ( isStart , opts = { } ) {
23
22
return new Promise ( ( resolve , reject ) => {
24
- opts = assign ( { } , defaultExts , opts ) ;
23
+ opts = Object . assign ( { } , defaultExts , opts ) ;
25
24
const filename = resolveFilename ( Object . assign ( { } , opts , {
26
25
extension : '' ,
27
26
frame : undefined
28
27
} ) ) ;
29
28
const func = isStart ? 'streamStart' : 'streamEnd' ;
30
29
const client = getClientAPI ( ) ;
31
30
if ( client && client . output && typeof client [ func ] === 'function' ) {
32
- return client [ func ] ( assign ( { } , opts , { filename } ) )
31
+ return client [ func ] ( Object . assign ( { } , opts , { filename } ) )
33
32
. then ( ev => resolve ( ev ) ) ;
34
33
} else {
35
34
return resolve ( { filename, client : false } ) ;
@@ -85,13 +84,13 @@ export function saveDataURL (dataURL, opts = {}) {
85
84
86
85
export function saveBlob ( blob , opts = { } ) {
87
86
return new Promise ( resolve => {
88
- opts = assign ( { } , defaultExts , opts ) ;
87
+ opts = Object . assign ( { } , defaultExts , opts ) ;
89
88
const filename = opts . filename ;
90
89
91
90
const client = getClientAPI ( ) ;
92
91
if ( client && typeof client . saveBlob === 'function' && client . output ) {
93
92
// native saving using a CLI tool
94
- return client . saveBlob ( blob , assign ( { } , opts , { filename } ) )
93
+ return client . saveBlob ( blob , Object . assign ( { } , opts , { filename } ) )
95
94
. then ( ev => resolve ( ev ) ) ;
96
95
} else {
97
96
// force download
@@ -135,7 +134,7 @@ export function getDefaultFile (prefix = '', suffix = '', ext) {
135
134
}
136
135
137
136
export function resolveFilename ( opt = { } ) {
138
- opt = assign ( { } , opt ) ;
137
+ opt = Object . assign ( { } , opt ) ;
139
138
140
139
// Custom filename function
141
140
if ( typeof opt . file === 'function' ) {
0 commit comments