File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -103,25 +103,26 @@ module.exports = function(AV) {
103103 * @param {Object } incloud appId, appKey, masterKey
104104 */
105105
106- AV . init = ( ...options ) => {
107- switch ( options . length ) {
106+ AV . init = ( ...args ) => {
107+ switch ( args . length ) {
108108 case 1 :
109+ const options = args [ 0 ] ;
109110 if ( typeof options === 'object' ) {
110111 if ( ! AV . _config . isNode && options . masterKey ) {
111112 throw new Error ( 'AV.init(): Master Key is only used in Node.js.' ) ;
112113 }
113- initialize ( options [ 0 ] . appId , options [ 0 ] . appKey , options [ 0 ] . masterKey ) ;
114+ initialize ( options . appId , options . appKey , options . masterKey ) ;
114115 } else {
115116 throw new Error ( 'AV.init(): Parameter is not correct.' ) ;
116117 }
117118 break ;
118119 // 兼容旧版本的初始化方法
119120 case 2 :
120121 case 3 :
121- if ( ! AV . _config . isNode && options . length === 3 ) {
122+ if ( ! AV . _config . isNode && args . length === 3 ) {
122123 throw new Error ( 'AV.init(): Master Key is only used in Node.js.' ) ;
123124 }
124- initialize ( ...options ) ;
125+ initialize ( ...args ) ;
125126 break ;
126127 }
127128 } ;
You can’t perform that action at this time.
0 commit comments