@@ -30,6 +30,8 @@ var _utils = require("./utils.js");
30
30
var _request = _interopRequireDefault ( require ( "./request.js" ) ) ;
31
31
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
32
32
function _typeof ( o ) { "@babel/helpers - typeof" ; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , _typeof ( o ) ; }
33
+ function ownKeys ( e , r ) { var t = Object . keys ( e ) ; if ( Object . getOwnPropertySymbols ) { var o = Object . getOwnPropertySymbols ( e ) ; r && ( o = o . filter ( function ( r ) { return Object . getOwnPropertyDescriptor ( e , r ) . enumerable ; } ) ) , t . push . apply ( t , o ) ; } return t ; }
34
+ function _objectSpread ( e ) { for ( var r = 1 ; r < arguments . length ; r ++ ) { var t = null != arguments [ r ] ? arguments [ r ] : { } ; r % 2 ? ownKeys ( Object ( t ) , ! 0 ) . forEach ( function ( r ) { _defineProperty ( e , r , t [ r ] ) ; } ) : Object . getOwnPropertyDescriptors ? Object . defineProperties ( e , Object . getOwnPropertyDescriptors ( t ) ) : ownKeys ( Object ( t ) ) . forEach ( function ( r ) { Object . defineProperty ( e , r , Object . getOwnPropertyDescriptor ( t , r ) ) ; } ) ; } return e ; }
33
35
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
34
36
function _defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , _toPropertyKey ( descriptor . key ) , descriptor ) ; } }
35
37
function _createClass ( Constructor , protoProps , staticProps ) { if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) _defineProperties ( Constructor , staticProps ) ; Object . defineProperty ( Constructor , "prototype" , { writable : false } ) ; return Constructor ; }
@@ -82,7 +84,7 @@ var Backend = function () {
82
84
var options = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
83
85
var allOptions = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : { } ;
84
86
this . services = services ;
85
- this . options = ( 0 , _utils . defaults ) ( options , this . options || { } , getDefaults ( ) ) ;
87
+ this . options = _objectSpread ( _objectSpread ( _objectSpread ( { } , getDefaults ( ) ) , this . options || { } ) , options ) ;
86
88
this . allOptions = allOptions ;
87
89
if ( this . services && this . options . reloadInterval ) {
88
90
setInterval ( function ( ) {
@@ -222,6 +224,11 @@ var _utils = require("./utils.js");
222
224
var fetchNode = _interopRequireWildcard ( require ( "./getFetch.js" ) ) ;
223
225
function _getRequireWildcardCache ( e ) { if ( "function" != typeof WeakMap ) return null ; var r = new WeakMap ( ) , t = new WeakMap ( ) ; return ( _getRequireWildcardCache = function _getRequireWildcardCache ( e ) { return e ? t : r ; } ) ( e ) ; }
224
226
function _interopRequireWildcard ( e , r ) { if ( ! r && e && e . __esModule ) return e ; if ( null === e || "object" != _typeof ( e ) && "function" != typeof e ) return { default : e } ; var t = _getRequireWildcardCache ( r ) ; if ( t && t . has ( e ) ) return t . get ( e ) ; var n = { __proto__ : null } , a = Object . defineProperty && Object . getOwnPropertyDescriptor ; for ( var u in e ) if ( "default" !== u && Object . prototype . hasOwnProperty . call ( e , u ) ) { var i = a ? Object . getOwnPropertyDescriptor ( e , u ) : null ; i && ( i . get || i . set ) ? Object . defineProperty ( n , u , i ) : n [ u ] = e [ u ] ; } return n . default = e , t && t . set ( e , n ) , n ; }
227
+ function ownKeys ( e , r ) { var t = Object . keys ( e ) ; if ( Object . getOwnPropertySymbols ) { var o = Object . getOwnPropertySymbols ( e ) ; r && ( o = o . filter ( function ( r ) { return Object . getOwnPropertyDescriptor ( e , r ) . enumerable ; } ) ) , t . push . apply ( t , o ) ; } return t ; }
228
+ function _objectSpread ( e ) { for ( var r = 1 ; r < arguments . length ; r ++ ) { var t = null != arguments [ r ] ? arguments [ r ] : { } ; r % 2 ? ownKeys ( Object ( t ) , ! 0 ) . forEach ( function ( r ) { _defineProperty ( e , r , t [ r ] ) ; } ) : Object . getOwnPropertyDescriptors ? Object . defineProperties ( e , Object . getOwnPropertyDescriptors ( t ) ) : ownKeys ( Object ( t ) ) . forEach ( function ( r ) { Object . defineProperty ( e , r , Object . getOwnPropertyDescriptor ( t , r ) ) ; } ) ; } return e ; }
229
+ function _defineProperty ( obj , key , value ) { key = _toPropertyKey ( key ) ; if ( key in obj ) { Object . defineProperty ( obj , key , { value : value , enumerable : true , configurable : true , writable : true } ) ; } else { obj [ key ] = value ; } return obj ; }
230
+ function _toPropertyKey ( arg ) { var key = _toPrimitive ( arg , "string" ) ; return _typeof ( key ) === "symbol" ? key : String ( key ) ; }
231
+ function _toPrimitive ( input , hint ) { if ( _typeof ( input ) !== "object" || input === null ) return input ; var prim = input [ Symbol . toPrimitive ] ; if ( prim !== undefined ) { var res = prim . call ( input , hint || "default" ) ; if ( _typeof ( res ) !== "object" ) return res ; throw new TypeError ( "@@toPrimitive must return a primitive value." ) ; } return ( hint === "string" ? String : Number ) ( input ) ; }
225
232
function _typeof ( o ) { "@babel/helpers - typeof" ; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol . iterator ? function ( o ) { return typeof o ; } : function ( o ) { return o && "function" == typeof Symbol && o . constructor === Symbol && o !== Symbol . prototype ? "symbol" : typeof o ; } , _typeof ( o ) ; }
226
233
var fetchApi ;
227
234
if ( typeof fetch === 'function' ) {
@@ -285,13 +292,13 @@ var requestWithFetch = function requestWithFetch(options, url, payload, callback
285
292
if ( options . queryStringParams ) {
286
293
url = addQueryString ( url , options . queryStringParams ) ;
287
294
}
288
- var headers = ( 0 , _utils . defaults ) ( { } , typeof options . customHeaders === 'function' ? options . customHeaders ( ) : options . customHeaders ) ;
295
+ var headers = _objectSpread ( { } , typeof options . customHeaders === 'function' ? options . customHeaders ( ) : options . customHeaders ) ;
289
296
if ( typeof window === 'undefined' && typeof global !== 'undefined' && typeof global . process !== 'undefined' && global . process . versions && global . process . versions . node ) {
290
297
headers [ 'User-Agent' ] = "i18next-http-backend (node/" . concat ( global . process . version , "; " ) . concat ( global . process . platform , " " ) . concat ( global . process . arch , ")" ) ;
291
298
}
292
299
if ( payload ) headers [ 'Content-Type' ] = 'application/json' ;
293
300
var reqOptions = typeof options . requestOptions === 'function' ? options . requestOptions ( payload ) : options . requestOptions ;
294
- var fetchOptions = ( 0 , _utils . defaults ) ( {
301
+ var fetchOptions = _objectSpread ( {
295
302
method : payload ? 'POST' : 'GET' ,
296
303
body : payload ? options . stringify ( payload ) : undefined ,
297
304
headers : headers
0 commit comments