@microsoft/applicationinsights-core-js 2.7.4-nightly.2202-02 → 2.7.4-nightly.2202-08

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +164 -126
  3. package/browser/applicationinsights-core-js.js.map +1 -1
  4. package/browser/applicationinsights-core-js.min.js +2 -2
  5. package/browser/applicationinsights-core-js.min.js.map +1 -1
  6. package/dist/applicationinsights-core-js.api.json +37 -111
  7. package/dist/applicationinsights-core-js.api.md +3 -3
  8. package/dist/applicationinsights-core-js.d.ts +4 -4
  9. package/dist/applicationinsights-core-js.js +164 -126
  10. package/dist/applicationinsights-core-js.js.map +1 -1
  11. package/dist/applicationinsights-core-js.min.js +2 -2
  12. package/dist/applicationinsights-core-js.min.js.map +1 -1
  13. package/dist/applicationinsights-core-js.rollup.d.ts +4 -4
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
  15. package/dist-esm/JavaScriptSDK/BaseCore.js +1 -1
  16. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
  17. package/dist-esm/JavaScriptSDK/ChannelController.js +1 -1
  18. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  19. package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
  20. package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
  21. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  22. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
  23. package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
  24. package/dist-esm/JavaScriptSDK/HelperFuncs.js +300 -115
  25. package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
  26. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +2 -35
  27. package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
  28. package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
  29. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  30. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
  31. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  32. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
  33. package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +1 -1
  34. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  35. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
  36. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  37. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  38. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  39. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  40. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  41. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  42. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  43. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  44. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  45. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  46. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  47. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  48. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  49. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  50. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  51. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  52. package/dist-esm/applicationinsights-core-js.js +1 -1
  53. package/package.json +1 -1
  54. package/src/JavaScriptSDK/HelperFuncs.ts +336 -114
  55. package/src/JavaScriptSDK/InstrumentHooks.ts +1 -41
  56. package/types/JavaScriptSDK/HelperFuncs.d.ts +42 -3
@@ -1,10 +1,10 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 2.7.4-nightly.2202-02
2
+ * Application Insights JavaScript SDK - Core, 2.7.4-nightly.2202-08
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
- import { strShimUndefined, strShimObject, strShimFunction, throwTypeError, ObjClass, ObjProto, ObjAssign, ObjHasOwnProperty, ObjDefineProperty } from "@microsoft/applicationinsights-shims";
7
+ import { strShimUndefined, strShimObject, strShimFunction, throwTypeError, ObjClass, ObjProto, ObjAssign, ObjHasOwnProperty, ObjDefineProperty, strShimPrototype } from "@microsoft/applicationinsights-shims";
8
8
  // RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly
9
9
  // Added to help with minfication
10
10
  var strOnPrefix = "on";
@@ -13,11 +13,66 @@ var strAddEventHelper = "addEventListener";
13
13
  var strDetachEvent = "detachEvent";
14
14
  var strRemoveEventListener = "removeEventListener";
15
15
  var strToISOString = "toISOString";
16
+ var cStrEndsWith = "endsWith";
17
+ var cStrStartsWith = "startsWith";
18
+ var strIndexOf = "indexOf";
19
+ var strMap = "map";
20
+ var strReduce = "reduce";
21
+ var cStrTrim = "trim";
22
+ var strToString = "toString";
23
+ /**
24
+ * Constant string defined to support minimization
25
+ * @ignore
26
+ */
27
+ var str__Proto = "__proto__";
28
+ /**
29
+ * Constant string defined to support minimization
30
+ * @ignore
31
+ */
32
+ var strConstructor = "constructor";
16
33
  var _objDefineProperty = ObjDefineProperty;
17
- var _objFreeze = ObjClass["freeze"];
18
- var _objSeal = ObjClass["seal"];
34
+ var _objFreeze = ObjClass.freeze;
35
+ var _objSeal = ObjClass.seal;
36
+ var _objKeys = ObjClass.keys;
37
+ var StringProto = String[strShimPrototype];
38
+ var _strTrim = StringProto[cStrTrim];
39
+ var _strEndsWith = StringProto[cStrEndsWith];
40
+ var _strStartsWith = StringProto[cStrStartsWith];
41
+ var DateProto = Date[strShimPrototype];
42
+ var _dataToISOString = DateProto[strToISOString];
43
+ var _isArray = Array.isArray;
44
+ var _objToString = ObjProto[strToString];
45
+ var _fnToString = ObjHasOwnProperty[strToString];
46
+ // Cache what this browser reports as the object function constructor (as a string)
47
+ var _objFunctionString = _fnToString.call(ObjClass);
48
+ var rCamelCase = /-([a-z])/g;
49
+ var rNormalizeInvalid = /([^\w\d_$])/g;
50
+ var rLeadingNumeric = /^(\d+[\w\d_$])/;
51
+ /**
52
+ * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)
53
+ * @ignore
54
+ */
55
+ var _objGetPrototypeOf = Object["getPrototypeOf"];
56
+ /**
57
+ * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.
58
+ * @ignore
59
+ */
60
+ export function _getObjProto(target) {
61
+ if (target) {
62
+ // This method doesn't existing in older browsers (e.g. IE8)
63
+ if (_objGetPrototypeOf) {
64
+ return _objGetPrototypeOf(target);
65
+ }
66
+ // target[Constructor] May break if the constructor has been changed or removed
67
+ var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
68
+ if (newProto) {
69
+ return newProto;
70
+ }
71
+ }
72
+ return null;
73
+ }
19
74
  export function objToString(obj) {
20
- return ObjProto.toString.call(obj);
75
+ return _objToString.call(obj);
21
76
  }
22
77
  export function isTypeof(value, theType) {
23
78
  return typeof value === theType;
@@ -35,15 +90,15 @@ export function isNotNullOrUndefined(value) {
35
90
  return !isNullOrUndefined(value);
36
91
  }
37
92
  export function hasOwnProperty(obj, prop) {
38
- return obj && ObjHasOwnProperty.call(obj, prop);
93
+ return !!(obj && ObjHasOwnProperty.call(obj, prop));
39
94
  }
40
95
  export function isObject(value) {
41
96
  // Changing to inline for performance
42
- return typeof value === strShimObject;
97
+ return !!(value && typeof value === strShimObject);
43
98
  }
44
99
  export function isFunction(value) {
45
100
  // Changing to inline for performance
46
- return typeof value === strShimFunction;
101
+ return !!(value && typeof value === strShimFunction);
47
102
  }
48
103
  /**
49
104
  * Binds the specified function to an event, so that the function gets called whenever the event fires on the object
@@ -107,9 +162,15 @@ export function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
107
162
  */
108
163
  export function normalizeJsName(name) {
109
164
  var value = name;
110
- var match = /([^\w\d_$])/g;
111
- if (match.test(name)) {
112
- value = name.replace(match, "_");
165
+ if (value && isString(value)) {
166
+ // CamelCase everything after the "-" and remove the dash
167
+ value = value.replace(rCamelCase, function (_all, letter) {
168
+ return letter.toUpperCase();
169
+ });
170
+ value = value.replace(rNormalizeInvalid, "_");
171
+ value = value.replace(rLeadingNumeric, function (_all, match) {
172
+ return "_" + match;
173
+ });
113
174
  }
114
175
  return value;
115
176
  }
@@ -135,24 +196,34 @@ export function objForEachKey(target, callbackfn) {
135
196
  * @returns true if the given search value is found at the end of the string, otherwise false.
136
197
  */
137
198
  export function strEndsWith(value, search) {
138
- if (value && search) {
139
- var searchLen = search.length;
140
- var valLen = value.length;
141
- if (value === search) {
142
- return true;
143
- }
144
- else if (valLen >= searchLen) {
145
- var pos = valLen - 1;
146
- for (var lp = searchLen - 1; lp >= 0; lp--) {
147
- if (value[pos] != search[lp]) {
148
- return false;
149
- }
150
- pos--;
199
+ var result = false;
200
+ if (value && search && !(result = value === search)) {
201
+ // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
202
+ result = _strEndsWith ? value[cStrEndsWith](search) : _strEndsWithPoly(value, search);
203
+ }
204
+ return result;
205
+ }
206
+ /**
207
+ * The _strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
208
+ * @param value - The value to check whether it ends with the search value.
209
+ * @param search - The characters to be searched for at the end of the value.
210
+ * @returns true if the given search value is found at the end of the string, otherwise false.
211
+ */
212
+ export function _strEndsWithPoly(value, search) {
213
+ var result = false;
214
+ var searchLen = search ? search.length : 0;
215
+ var valLen = value ? value.length : 0;
216
+ if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {
217
+ var pos = valLen - 1;
218
+ for (var lp = searchLen - 1; lp >= 0; lp--) {
219
+ if (value[pos] != search[lp]) {
220
+ return false;
151
221
  }
152
- return true;
222
+ pos--;
153
223
  }
224
+ result = true;
154
225
  }
155
- return false;
226
+ return result;
156
227
  }
157
228
  /**
158
229
  * The strStartsWith() method determines whether a string starts with the characters of the specified string, returning true or false as appropriate.
@@ -161,21 +232,30 @@ export function strEndsWith(value, search) {
161
232
  * @returns true if the given search value is found at the start of the string, otherwise false.
162
233
  */
163
234
  export function strStartsWith(value, checkValue) {
235
+ var result = false;
236
+ if (value && checkValue && !(result = value === checkValue)) {
237
+ // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
238
+ result = _strStartsWith ? value[cStrStartsWith](checkValue) : _strStartsWithPoly(value, checkValue);
239
+ }
240
+ return result;
241
+ }
242
+ /**
243
+ * The strStartsWith() method determines whether a string starts with the characters of the specified string, returning true or false as appropriate.
244
+ * @param value - The value to check whether it ends with the search value.
245
+ * @param checkValue - The characters to be searched for at the start of the value.
246
+ * @returns true if the given search value is found at the start of the string, otherwise false.
247
+ */
248
+ export function _strStartsWithPoly(value, checkValue) {
164
249
  // Using helper for performance and because string startsWith() is not available on IE
165
250
  var result = false;
166
- if (value && checkValue) {
167
- var chkLen = checkValue.length;
168
- if (value === checkValue) {
169
- return true;
170
- }
171
- else if (value.length >= chkLen) {
172
- for (var lp = 0; lp < chkLen; lp++) {
173
- if (value[lp] !== checkValue[lp]) {
174
- return false;
175
- }
251
+ var chkLen = checkValue ? checkValue.length : 0;
252
+ if (value && chkLen && value.length >= chkLen && !(result = value === checkValue)) {
253
+ for (var lp = 0; lp < chkLen; lp++) {
254
+ if (value[lp] !== checkValue[lp]) {
255
+ return false;
176
256
  }
177
- result = true;
178
257
  }
258
+ result = true;
179
259
  }
180
260
  return result;
181
261
  }
@@ -194,19 +274,20 @@ export function strContains(value, search) {
194
274
  * Check if an object is of type Date
195
275
  */
196
276
  export function isDate(obj) {
197
- return objToString(obj) === "[object Date]";
277
+ return !!(obj && _objToString.call(obj) === "[object Date]");
198
278
  }
199
279
  /**
200
280
  * Check if an object is of type Array
201
281
  */
202
- export function isArray(obj) {
203
- return objToString(obj) === "[object Array]";
282
+ export var isArray = _isArray || _isArrayPoly;
283
+ function _isArrayPoly(obj) {
284
+ return !!(obj && _objToString.call(obj) === "[object Array]");
204
285
  }
205
286
  /**
206
287
  * Check if an object is of type Error
207
288
  */
208
289
  export function isError(obj) {
209
- return objToString(obj) === "[object Error]";
290
+ return !!(obj && _objToString.call(obj) === "[object Error]");
210
291
  }
211
292
  /**
212
293
  * Checks if the type of value is a string.
@@ -244,32 +325,58 @@ export function isBoolean(value) {
244
325
  export function isSymbol(value) {
245
326
  return typeof value === "symbol";
246
327
  }
328
+ /**
329
+ * Checks if the type of the value is a normal plain object (not a null or data)
330
+ * @param value
331
+ */
332
+ export function isPlainObject(value) {
333
+ var result = false;
334
+ if (value && typeof value === "object") {
335
+ // Inlining _objGetPrototypeOf for performance to avoid an additional function call
336
+ var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
337
+ if (!proto) {
338
+ // No prototype found so this is a plain Object eg. 'Object.create(null)'
339
+ result = true;
340
+ }
341
+ else {
342
+ // Objects that have a prototype are plain only if they were created using the Object global (native) function
343
+ if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
344
+ proto = proto[strConstructor];
345
+ }
346
+ result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
347
+ }
348
+ }
349
+ return result;
350
+ }
247
351
  /**
248
352
  * Convert a date to I.S.O. format in IE8
249
353
  */
250
354
  export function toISOString(date) {
251
355
  if (date) {
252
- if (date[strToISOString]) {
253
- // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
254
- return date[strToISOString]();
255
- }
256
- if (isDate(date)) {
257
- var pad = function (num) {
258
- var r = String(num);
259
- if (r.length === 1) {
260
- r = "0" + r;
261
- }
262
- return r;
263
- };
264
- return date.getUTCFullYear()
265
- + "-" + pad(date.getUTCMonth() + 1)
266
- + "-" + pad(date.getUTCDate())
267
- + "T" + pad(date.getUTCHours())
268
- + ":" + pad(date.getUTCMinutes())
269
- + ":" + pad(date.getUTCSeconds())
270
- + "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
271
- + "Z";
272
- }
356
+ // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
357
+ return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
358
+ }
359
+ }
360
+ /**
361
+ * Convert a date to I.S.O. format in IE8
362
+ */
363
+ export function _toISOStringPoly(date) {
364
+ if (date && date.getUTCFullYear) {
365
+ var pad = function (num) {
366
+ var r = String(num);
367
+ if (r.length === 1) {
368
+ r = "0" + r;
369
+ }
370
+ return r;
371
+ };
372
+ return date.getUTCFullYear()
373
+ + "-" + pad(date.getUTCMonth() + 1)
374
+ + "-" + pad(date.getUTCDate())
375
+ + "T" + pad(date.getUTCHours())
376
+ + ":" + pad(date.getUTCMinutes())
377
+ + ":" + pad(date.getUTCSeconds())
378
+ + "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
379
+ + "Z";
273
380
  }
274
381
  }
275
382
  /**
@@ -304,17 +411,23 @@ export function arrForEach(arr, callbackfn, thisArg) {
304
411
  * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
305
412
  */
306
413
  export function arrIndexOf(arr, searchElement, fromIndex) {
307
- var len = arr.length;
308
- var from = fromIndex || 0;
309
- try {
310
- for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {
311
- if (lp in arr && arr[lp] === searchElement) {
312
- return lp;
414
+ if (arr) {
415
+ // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
416
+ if (arr[strIndexOf]) {
417
+ return arr[strIndexOf](searchElement, fromIndex);
418
+ }
419
+ var len = arr.length;
420
+ var from = fromIndex || 0;
421
+ try {
422
+ for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {
423
+ if (lp in arr && arr[lp] === searchElement) {
424
+ return lp;
425
+ }
313
426
  }
314
427
  }
315
- }
316
- catch (e) {
317
- // This can happen with some native browser objects, but should not happen for the type we are checking for
428
+ catch (e) {
429
+ // This can happen with some native browser objects, but should not happen for the type we are checking for
430
+ }
318
431
  }
319
432
  return -1;
320
433
  }
@@ -327,18 +440,25 @@ export function arrIndexOf(arr, searchElement, fromIndex) {
327
440
  * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
328
441
  */
329
442
  export function arrMap(arr, callbackfn, thisArg) {
330
- var len = arr.length;
331
- var _this = thisArg || arr;
332
- var results = new Array(len);
333
- try {
334
- for (var lp = 0; lp < len; lp++) {
335
- if (lp in arr) {
336
- results[lp] = callbackfn.call(_this, arr[lp], arr);
443
+ var results;
444
+ if (arr) {
445
+ // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
446
+ if (arr[strMap]) {
447
+ return arr[strMap](callbackfn, thisArg);
448
+ }
449
+ var len = arr.length;
450
+ var _this = thisArg || arr;
451
+ results = new Array(len);
452
+ try {
453
+ for (var lp = 0; lp < len; lp++) {
454
+ if (lp in arr) {
455
+ results[lp] = callbackfn.call(_this, arr[lp], arr);
456
+ }
337
457
  }
338
458
  }
339
- }
340
- catch (e) {
341
- // This can happen with some native browser objects, but should not happen for the type we are checking for
459
+ catch (e) {
460
+ // This can happen with some native browser objects, but should not happen for the type we are checking for
461
+ }
342
462
  }
343
463
  return results;
344
464
  }
@@ -351,24 +471,30 @@ export function arrMap(arr, callbackfn, thisArg) {
351
471
  * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
352
472
  */
353
473
  export function arrReduce(arr, callbackfn, initialValue) {
354
- var len = arr.length;
355
- var lp = 0;
356
474
  var value;
357
- // Specifically checking the number of passed arguments as the value could be anything
358
- if (arguments.length >= 3) {
359
- value = arguments[2];
360
- }
361
- else {
362
- while (lp < len && !(lp in arr)) {
363
- lp++;
475
+ if (arr) {
476
+ // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
477
+ if (arr[strReduce]) {
478
+ return arr[strReduce](callbackfn, initialValue);
364
479
  }
365
- value = arr[lp++];
366
- }
367
- while (lp < len) {
368
- if (lp in arr) {
369
- value = callbackfn(value, arr[lp], lp, arr);
480
+ var len = arr.length;
481
+ var lp = 0;
482
+ // Specifically checking the number of passed arguments as the value could be anything
483
+ if (arguments.length >= 3) {
484
+ value = arguments[2];
485
+ }
486
+ else {
487
+ while (lp < len && !(lp in arr)) {
488
+ lp++;
489
+ }
490
+ value = arr[lp++];
491
+ }
492
+ while (lp < len) {
493
+ if (lp in arr) {
494
+ value = callbackfn(value, arr[lp], lp, arr);
495
+ }
496
+ lp++;
370
497
  }
371
- lp++;
372
498
  }
373
499
  return value;
374
500
  }
@@ -376,10 +502,11 @@ export function arrReduce(arr, callbackfn, initialValue) {
376
502
  * helper method to trim strings (IE8 does not implement String.prototype.trim)
377
503
  */
378
504
  export function strTrim(str) {
379
- if (typeof str !== "string") {
380
- return str;
505
+ if (str) {
506
+ // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
507
+ str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\s+|\s+$/g, "") : str);
381
508
  }
382
- return str.replace(/^\s+|\s+$/g, "");
509
+ return str;
383
510
  }
384
511
  var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
385
512
  var _objKeysDontEnums = [
@@ -402,6 +529,10 @@ export function objKeys(obj) {
402
529
  if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
403
530
  throwTypeError("objKeys called on non-object");
404
531
  }
532
+ // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
533
+ if (!_objKeysHasDontEnumBug && _objKeys) {
534
+ return _objKeys(obj);
535
+ }
405
536
  var result = [];
406
537
  for (var prop in obj) {
407
538
  if (obj && ObjHasOwnProperty.call(obj, prop)) {
@@ -451,28 +582,18 @@ export function objDefineAccessors(target, prop, getProp, setProp) {
451
582
  }
452
583
  return false;
453
584
  }
454
- export function objFreeze(value) {
455
- if (_objFreeze) {
456
- value = _objFreeze(value);
457
- }
458
- return value;
459
- }
460
- export function objSeal(value) {
461
- if (_objSeal) {
462
- value = _objSeal(value);
463
- }
585
+ function _doNothing(value) {
464
586
  return value;
465
587
  }
588
+ export var objFreeze = _objFreeze || _doNothing;
589
+ export var objSeal = _objSeal || _doNothing;
466
590
  /**
467
591
  * Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)
468
592
  * https://caniuse.com/#search=Date.now
469
593
  */
470
594
  export function dateNow() {
471
595
  var dt = Date;
472
- if (dt.now) {
473
- return dt.now();
474
- }
475
- return new dt().getTime();
596
+ return dt.now ? dt.now() : new dt().getTime();
476
597
  }
477
598
  /**
478
599
  * Returns the name of object if it's an Error. Otherwise, returns empty string.
@@ -621,9 +742,73 @@ export function createClassFromInterface(defaults) {
621
742
  export function optimizeObject(theObject) {
622
743
  // V8 Optimization to cause the JIT compiler to create a new optimized object for looking up the own properties
623
744
  // primarily for object with <= 19 properties for >= 20 the effect is reduced or non-existent
624
- if (theObject) {
625
- theObject = ObjClass(ObjAssign ? ObjAssign({}, theObject) : theObject);
745
+ if (theObject && ObjAssign) {
746
+ theObject = ObjClass(ObjAssign({}, theObject));
626
747
  }
627
748
  return theObject;
628
749
  }
750
+ /**
751
+ * Pass in the objects to merge as arguments, this will only "merge" (extend) properties that are owned by the object.
752
+ * It will NOT merge inherited or non-enumerable properties.
753
+ * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.
754
+ * @param obj2 - object to merge.
755
+ * @param obj3 - object to merge.
756
+ * @param obj4 - object to merge.
757
+ * @param obj5 - object to merge.
758
+ * @returns The extended first object.
759
+ */
760
+ export function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
761
+ // Variables
762
+ var theArgs = arguments;
763
+ var extended = theArgs[0] || {};
764
+ var argLen = theArgs.length;
765
+ var deep = false;
766
+ var idx = 1;
767
+ // Check for "Deep" flag
768
+ if (argLen > 0 && isBoolean(extended)) {
769
+ deep = extended;
770
+ extended = theArgs[idx] || {};
771
+ idx++;
772
+ }
773
+ // Handle case when target is a string or something (possible in deep copy)
774
+ if (!isObject(extended)) {
775
+ extended = {};
776
+ }
777
+ // Loop through each remaining object and conduct a merge
778
+ for (; idx < argLen; idx++) {
779
+ var arg = theArgs[idx];
780
+ var isArgArray = isArray(arg);
781
+ var isArgObj = isObject(arg);
782
+ for (var prop in arg) {
783
+ var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
784
+ if (!propOk) {
785
+ continue;
786
+ }
787
+ var newValue = arg[prop];
788
+ var isNewArray = void 0;
789
+ // If deep merge and property is an object, merge properties
790
+ if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
791
+ // Grab the current value of the extended object
792
+ var clone = extended[prop];
793
+ if (isNewArray) {
794
+ if (!isArray(clone)) {
795
+ // We can't "merge" an array with a non-array so overwrite the original
796
+ clone = [];
797
+ }
798
+ }
799
+ else if (!isPlainObject(clone)) {
800
+ // We can't "merge" an object with a non-object
801
+ clone = {};
802
+ }
803
+ // Never move the original objects always clone them
804
+ newValue = objExtend(deep, clone, newValue);
805
+ }
806
+ // Assign the new (or previous) value (unless undefined)
807
+ if (newValue !== undefined) {
808
+ extended[prop] = newValue;
809
+ }
810
+ }
811
+ }
812
+ return extended;
813
+ }
629
814
  //# sourceMappingURL=HelperFuncs.js.map