@@ -17,41 +17,28 @@ var uuid = require('uuid');
1717var _isFinite = require ( 'lodash/isFinite' ) ;
1818var MAX_NUMBER_LIMIT = Math . pow ( 2 , 53 ) ;
1919
20- // Polyfills for older browsers
21- var applyPolyfills = function ( ) {
22- if ( typeof Object . assign !== 'function' ) {
23- // Must be writable: true, enumerable: false, configurable: true
24- Object . defineProperty ( Object , "assign" , {
25- value : function assign ( target ) {
26- 'use strict' ;
27- if ( target === null || target === undefined ) {
28- throw new TypeError ( 'Cannot convert undefined or null to object' ) ;
29- }
30- var to = Object ( target ) ;
31- for ( var index = 1 ; index < arguments . length ; index ++ ) {
32- var nextSource = arguments [ index ] ;
33-
34- if ( nextSource !== null && nextSource !== undefined ) {
35- for ( var nextKey in nextSource ) {
36- // Avoid bugs when hasOwnProperty is shadowed
37- if ( Object . prototype . hasOwnProperty . call ( nextSource , nextKey ) ) {
38- to [ nextKey ] = nextSource [ nextKey ] ;
39- }
20+ module . exports = {
21+ assign : function ( target ) {
22+ if ( ! target ) {
23+ return { } ;
24+ }
25+ if ( typeof Object . assign === 'function' ) {
26+ return Object . assign . apply ( Object , arguments ) ;
27+ } else {
28+ var to = Object ( target ) ;
29+ for ( var index = 1 ; index < arguments . length ; index ++ ) {
30+ var nextSource = arguments [ index ] ;
31+ if ( nextSource !== null && nextSource !== undefined ) {
32+ for ( var nextKey in nextSource ) {
33+ // Avoid bugs when hasOwnProperty is shadowed
34+ if ( Object . prototype . hasOwnProperty . call ( nextSource , nextKey ) ) {
35+ to [ nextKey ] = nextSource [ nextKey ] ;
4036 }
4137 }
4238 }
43- return to ;
44- } ,
45- writable : true ,
46- configurable : true
47- } ) ;
48- }
49- }
50-
51- module . exports = {
52- assign : function ( target ) {
53- // Object.assign crashes if target object is undefined or null
54- return target ? Object . assign . apply ( Object , arguments ) : { } ;
39+ }
40+ return to ;
41+ }
5542 } ,
5643 assignIn : require ( 'lodash/assignIn' ) ,
5744 cloneDeep : require ( 'lodash/cloneDeep' ) ,
@@ -68,7 +55,6 @@ module.exports = {
6855 return uuid . v4 ( ) ;
6956 } ,
7057 values : require ( 'lodash/values' ) ,
71- applyPolyfills : applyPolyfills ,
7258 isNumber : function ( value ) {
7359 return typeof value === 'number' ;
7460 } ,
0 commit comments