@microsoft/applicationinsights-core-js 3.0.0-beta.2208-04 → 3.0.0-beta.2208-18
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.
- package/README.md +7 -0
- package/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +2040 -2155
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +6998 -10817
- package/dist/applicationinsights-core-js.api.md +88 -177
- package/dist/applicationinsights-core-js.d.ts +94 -494
- package/dist/applicationinsights-core-js.js +2040 -2155
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +94 -494
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +2 -2
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +11 -12
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +3 -2
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +2 -2
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +27 -26
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +8 -140
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +3 -3
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +4 -3
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +132 -136
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +2 -3
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +23 -470
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +5 -5
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +4 -4
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +2 -2
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +4 -8
- package/dist-esm/JavaScriptSDK/PerfManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +3 -3
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +2 -2
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +3 -3
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +2 -3
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -1
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js +2 -2
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +5 -31
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
- package/dist-esm/__DynamicConstants.js +11 -13
- package/dist-esm/__DynamicConstants.js.map +1 -1
- package/dist-esm/applicationinsights-core-js.js +6 -5
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +4 -3
- package/src/JavaScriptSDK/AppInsightsCore.ts +1 -1
- package/src/JavaScriptSDK/BaseCore.ts +2 -4
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +2 -1
- package/src/JavaScriptSDK/ChannelController.ts +1 -1
- package/src/JavaScriptSDK/CookieMgr.ts +6 -5
- package/src/JavaScriptSDK/CoreUtils.ts +7 -423
- package/src/JavaScriptSDK/DbgExtensionUtils.ts +2 -2
- package/src/JavaScriptSDK/DiagnosticLogger.ts +3 -2
- package/src/JavaScriptSDK/EnvUtils.ts +145 -148
- package/src/JavaScriptSDK/EventHelpers.ts +1 -2
- package/src/JavaScriptSDK/HelperFuncs.ts +22 -536
- package/src/JavaScriptSDK/InstrumentHooks.ts +4 -4
- package/src/JavaScriptSDK/InternalConstants.ts +3 -3
- package/src/JavaScriptSDK/NotificationManager.ts +1 -1
- package/src/JavaScriptSDK/PerfManager.ts +3 -7
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +4 -4
- package/src/JavaScriptSDK/TelemetryHelpers.ts +1 -1
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +2 -2
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +1 -2
- package/src/JavaScriptSDK/W3cTraceParent.ts +1 -1
- package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +5 -36
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +7 -0
- package/tsconfig.json +1 -1
- package/types/JavaScriptSDK/CoreUtils.d.ts +0 -270
- package/types/JavaScriptSDK/EnvUtils.d.ts +0 -65
- package/types/JavaScriptSDK/HelperFuncs.d.ts +3 -154
- package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +6 -18
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +6 -0
- package/types/__DynamicConstants.d.ts +2 -4
- package/types/applicationinsights-core-js.d.ts +5 -4
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,105 +1,50 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2208-
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2208-18
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
import { ObjAssign, ObjClass,
|
|
8
|
-
import {
|
|
7
|
+
import { ObjAssign, ObjClass, ObjHasOwnProperty, ObjProto, strShimFunction, strShimPrototype } from "@microsoft/applicationinsights-shims";
|
|
8
|
+
import { arrForEach, isArray, isBoolean, isError, isFunction, isNullOrUndefined, isObject, isString, isUndefined, objDeepFreeze, objDefineAccessors, objForEachKey, objHasOwnProperty, strIndexOf, throwUnsupported } from "@nevware21/ts-utils";
|
|
9
|
+
import { _DYN_APPLY, _DYN_CALL, _DYN_LENGTH, _DYN_NAME, _DYN_REPLACE } from "../__DynamicConstants";
|
|
9
10
|
import { STR_EMPTY } from "./InternalConstants";
|
|
10
11
|
// RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly
|
|
11
|
-
// Added to help with
|
|
12
|
+
// Added to help with minification
|
|
13
|
+
var cString = "String";
|
|
14
|
+
var cObject = "Object";
|
|
12
15
|
var strToISOString = "toISOString";
|
|
13
|
-
var cStrEndsWith = "endsWith";
|
|
14
|
-
var cStrStartsWith = "startsWith";
|
|
15
|
-
var strIndexOf = "indexOf";
|
|
16
16
|
var strMap = "map";
|
|
17
|
-
var strReduce = "reduce";
|
|
18
|
-
var cStrTrim = "trim";
|
|
19
17
|
var strToString = "toString";
|
|
20
|
-
|
|
21
|
-
* Constant string defined to support minimization
|
|
22
|
-
* @ignore
|
|
23
|
-
*/
|
|
24
|
-
var str__Proto = "__proto__";
|
|
18
|
+
var strGetPrototypeOf = "getPrototypeOf";
|
|
25
19
|
/**
|
|
26
20
|
* Constant string defined to support minimization
|
|
27
21
|
* @ignore
|
|
28
22
|
*/
|
|
29
23
|
var strConstructor = "constructor";
|
|
30
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
31
|
-
var _objFreeze = ObjClass.freeze;
|
|
32
|
-
var _objSeal = ObjClass.seal;
|
|
33
|
-
var _objKeys = ObjClass.keys;
|
|
34
|
-
var StringProto = String[strShimPrototype];
|
|
35
|
-
var _strTrim = StringProto[cStrTrim];
|
|
36
|
-
var _strEndsWith = StringProto[cStrEndsWith];
|
|
37
|
-
var _strStartsWith = StringProto[cStrStartsWith];
|
|
38
24
|
var DateProto = Date[strShimPrototype];
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var _fnToString = ObjHasOwnProperty[strToString];
|
|
25
|
+
var _dateToISOString = DateProto[strToISOString] || _polyfillRequired("Date", strToISOString);
|
|
26
|
+
var _objToString = ObjProto[strToString] || _polyfillRequired(cObject, strToString);
|
|
27
|
+
var _fnToString = ObjHasOwnProperty[strToString] || _polyfillRequired(cString, strToString);
|
|
43
28
|
// Cache what this browser reports as the object function constructor (as a string)
|
|
44
29
|
var _objFunctionString = _fnToString[_DYN_CALL /* @min:%2ecall */](ObjClass);
|
|
45
30
|
var rCamelCase = /-([a-z])/g;
|
|
46
31
|
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
47
32
|
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
53
|
-
/**
|
|
54
|
-
* Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.
|
|
55
|
-
* @ignore
|
|
56
|
-
*/
|
|
57
|
-
export function _getObjProto(target) {
|
|
58
|
-
if (target) {
|
|
59
|
-
// This method doesn't existing in older browsers (e.g. IE8)
|
|
60
|
-
if (_objGetPrototypeOf) {
|
|
61
|
-
return _objGetPrototypeOf(target);
|
|
62
|
-
}
|
|
63
|
-
// target[Constructor] May break if the constructor has been changed or removed
|
|
64
|
-
var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
65
|
-
if (newProto) {
|
|
66
|
-
return newProto;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return null;
|
|
33
|
+
function _polyfillRequired(object, name) {
|
|
34
|
+
return function () {
|
|
35
|
+
throwUnsupported("Polyfill required for [" + name + "]");
|
|
36
|
+
};
|
|
70
37
|
}
|
|
38
|
+
export var _getObjProto = Object[strGetPrototypeOf] || _polyfillRequired(cObject, strGetPrototypeOf);
|
|
71
39
|
export function objToString(obj) {
|
|
72
40
|
return _objToString[_DYN_CALL /* @min:%2ecall */](obj);
|
|
73
41
|
}
|
|
74
|
-
export function isTypeof(value, theType) {
|
|
75
|
-
return typeof value === theType;
|
|
76
|
-
}
|
|
77
|
-
export function isUndefined(value) {
|
|
78
|
-
return value === undefined || typeof value === strShimUndefined;
|
|
79
|
-
}
|
|
80
42
|
export function isNotUndefined(value) {
|
|
81
43
|
return !isUndefined(value);
|
|
82
44
|
}
|
|
83
|
-
export function isNullOrUndefined(value) {
|
|
84
|
-
return (value === null || isUndefined(value));
|
|
85
|
-
}
|
|
86
45
|
export function isNotNullOrUndefined(value) {
|
|
87
46
|
return !isNullOrUndefined(value);
|
|
88
47
|
}
|
|
89
|
-
export function hasOwnProperty(obj, prop) {
|
|
90
|
-
return !!(obj && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](obj, prop));
|
|
91
|
-
}
|
|
92
|
-
export function isObject(value) {
|
|
93
|
-
// Changing to inline for performance
|
|
94
|
-
return !!(value && typeof value === strShimObject);
|
|
95
|
-
}
|
|
96
|
-
export function isFunction(value) {
|
|
97
|
-
// Changing to inline for performance
|
|
98
|
-
return !!(value && typeof value === strShimFunction);
|
|
99
|
-
}
|
|
100
|
-
export function isPromiseLike(value) {
|
|
101
|
-
return value && isFunction(value.then);
|
|
102
|
-
}
|
|
103
48
|
/**
|
|
104
49
|
* Validates that the string name conforms to the JS IdentifierName specification and if not
|
|
105
50
|
* normalizes the name so that it would. This method does not identify or change any keywords
|
|
@@ -121,91 +66,6 @@ export function normalizeJsName(name) {
|
|
|
121
66
|
}
|
|
122
67
|
return value;
|
|
123
68
|
}
|
|
124
|
-
/**
|
|
125
|
-
* This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a
|
|
126
|
-
* performance optimization to avoid the creation of a new array for large objects
|
|
127
|
-
* @param target The target object to find and process the keys
|
|
128
|
-
* @param callbackfn The function to call with the details
|
|
129
|
-
*/
|
|
130
|
-
export function objForEachKey(target, callbackfn) {
|
|
131
|
-
if (target) {
|
|
132
|
-
for (var prop in target) {
|
|
133
|
-
if (ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](target, prop)) {
|
|
134
|
-
callbackfn[_DYN_CALL /* @min:%2ecall */](target, prop, target[prop]);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
|
|
141
|
-
* @param value - The value to check whether it ends with the search value.
|
|
142
|
-
* @param search - The characters to be searched for at the end of the value.
|
|
143
|
-
* @returns true if the given search value is found at the end of the string, otherwise false.
|
|
144
|
-
*/
|
|
145
|
-
export function strEndsWith(value, search) {
|
|
146
|
-
var result = false;
|
|
147
|
-
if (value && search && !(result = value === search)) {
|
|
148
|
-
// For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
|
|
149
|
-
result = _strEndsWith ? value[cStrEndsWith](search) : _strEndsWithPoly(value, search);
|
|
150
|
-
}
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* The _strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
|
|
155
|
-
* @param value - The value to check whether it ends with the search value.
|
|
156
|
-
* @param search - The characters to be searched for at the end of the value.
|
|
157
|
-
* @returns true if the given search value is found at the end of the string, otherwise false.
|
|
158
|
-
*/
|
|
159
|
-
export function _strEndsWithPoly(value, search) {
|
|
160
|
-
var result = false;
|
|
161
|
-
var searchLen = search ? search[_DYN_LENGTH /* @min:%2elength */] : 0;
|
|
162
|
-
var valLen = value ? value[_DYN_LENGTH /* @min:%2elength */] : 0;
|
|
163
|
-
if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {
|
|
164
|
-
var pos = valLen - 1;
|
|
165
|
-
for (var lp = searchLen - 1; lp >= 0; lp--) {
|
|
166
|
-
if (value[pos] != search[lp]) {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
pos--;
|
|
170
|
-
}
|
|
171
|
-
result = true;
|
|
172
|
-
}
|
|
173
|
-
return result;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* The strStartsWith() method determines whether a string starts with the characters of the specified string, returning true or false as appropriate.
|
|
177
|
-
* @param value - The value to check whether it ends with the search value.
|
|
178
|
-
* @param checkValue - The characters to be searched for at the start of the value.
|
|
179
|
-
* @returns true if the given search value is found at the start of the string, otherwise false.
|
|
180
|
-
*/
|
|
181
|
-
export function strStartsWith(value, checkValue) {
|
|
182
|
-
var result = false;
|
|
183
|
-
if (value && checkValue && !(result = value === checkValue)) {
|
|
184
|
-
// For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
|
|
185
|
-
result = _strStartsWith ? value[cStrStartsWith](checkValue) : _strStartsWithPoly(value, checkValue);
|
|
186
|
-
}
|
|
187
|
-
return result;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* The strStartsWith() method determines whether a string starts with the characters of the specified string, returning true or false as appropriate.
|
|
191
|
-
* @param value - The value to check whether it ends with the search value.
|
|
192
|
-
* @param checkValue - The characters to be searched for at the start of the value.
|
|
193
|
-
* @returns true if the given search value is found at the start of the string, otherwise false.
|
|
194
|
-
*/
|
|
195
|
-
export function _strStartsWithPoly(value, checkValue) {
|
|
196
|
-
// Using helper for performance and because string startsWith() is not available on IE
|
|
197
|
-
var result = false;
|
|
198
|
-
var chkLen = checkValue ? checkValue[_DYN_LENGTH /* @min:%2elength */] : 0;
|
|
199
|
-
if (value && chkLen && value[_DYN_LENGTH /* @min:%2elength */] >= chkLen && !(result = value === checkValue)) {
|
|
200
|
-
for (var lp = 0; lp < chkLen; lp++) {
|
|
201
|
-
if (value[lp] !== checkValue[lp]) {
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
result = true;
|
|
206
|
-
}
|
|
207
|
-
return result;
|
|
208
|
-
}
|
|
209
69
|
/**
|
|
210
70
|
* A simple wrapper (for minification support) to check if the value contains the search string.
|
|
211
71
|
* @param value - The string value to check for the existence of the search value
|
|
@@ -213,66 +73,10 @@ export function _strStartsWithPoly(value, checkValue) {
|
|
|
213
73
|
*/
|
|
214
74
|
export function strContains(value, search) {
|
|
215
75
|
if (value && search) {
|
|
216
|
-
return value
|
|
76
|
+
return strIndexOf(value, search) !== -1;
|
|
217
77
|
}
|
|
218
78
|
return false;
|
|
219
79
|
}
|
|
220
|
-
/**
|
|
221
|
-
* Check if an object is of type Date
|
|
222
|
-
*/
|
|
223
|
-
export function isDate(obj) {
|
|
224
|
-
return !!(obj && _objToString[_DYN_CALL /* @min:%2ecall */](obj) === "[object Date]");
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Check if an object is of type Array with optional generic T, the generic type is not validated
|
|
228
|
-
* and exists to help with TypeScript validation only.
|
|
229
|
-
*/
|
|
230
|
-
export var isArray = _isArray || _isArrayPoly;
|
|
231
|
-
function _isArrayPoly(obj) {
|
|
232
|
-
return !!(obj && _objToString[_DYN_CALL /* @min:%2ecall */](obj) === "[object Array]");
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Check if an object is of type Error
|
|
236
|
-
*/
|
|
237
|
-
export function isError(obj) {
|
|
238
|
-
return !!(obj && _objToString[_DYN_CALL /* @min:%2ecall */](obj) === "[object Error]");
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Checks if the type of value is a string.
|
|
242
|
-
* @param {any} value - Value to be checked.
|
|
243
|
-
* @return {boolean} True if the value is a string, false otherwise.
|
|
244
|
-
*/
|
|
245
|
-
export function isString(value) {
|
|
246
|
-
// Changing to inline for performance
|
|
247
|
-
return typeof value === "string";
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Checks if the type of value is a number.
|
|
251
|
-
* @param {any} value - Value to be checked.
|
|
252
|
-
* @return {boolean} True if the value is a number, false otherwise.
|
|
253
|
-
*/
|
|
254
|
-
export function isNumber(value) {
|
|
255
|
-
// Changing to inline for performance
|
|
256
|
-
return typeof value === "number";
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Checks if the type of value is a boolean.
|
|
260
|
-
* @param {any} value - Value to be checked.
|
|
261
|
-
* @return {boolean} True if the value is a boolean, false otherwise.
|
|
262
|
-
*/
|
|
263
|
-
export function isBoolean(value) {
|
|
264
|
-
// Changing to inline for performance
|
|
265
|
-
return typeof value === "boolean";
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Checks if the type of value is a Symbol.
|
|
269
|
-
* This only returns a boolean as returning value is Symbol will cause issues for older TypeScript consumers
|
|
270
|
-
* @param {any} value - Value to be checked.
|
|
271
|
-
* @return {boolean} True if the value is a Symbol, false otherwise.
|
|
272
|
-
*/
|
|
273
|
-
export function isSymbol(value) {
|
|
274
|
-
return typeof value === "symbol";
|
|
275
|
-
}
|
|
276
80
|
/**
|
|
277
81
|
* Checks if the type of the value is a normal plain object (not a null or data)
|
|
278
82
|
* @param value
|
|
@@ -281,7 +85,7 @@ export function isPlainObject(value) {
|
|
|
281
85
|
var result = false;
|
|
282
86
|
if (value && typeof value === "object") {
|
|
283
87
|
// Inlining _objGetPrototypeOf for performance to avoid an additional function call
|
|
284
|
-
var proto =
|
|
88
|
+
var proto = _getObjProto(value);
|
|
285
89
|
if (!proto) {
|
|
286
90
|
// No prototype found so this is a plain Object eg. 'Object.create(null)'
|
|
287
91
|
result = true;
|
|
@@ -300,251 +104,9 @@ export function isPlainObject(value) {
|
|
|
300
104
|
* Convert a date to I.S.O. format in IE8
|
|
301
105
|
*/
|
|
302
106
|
export function toISOString(date) {
|
|
303
|
-
|
|
304
|
-
// For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
|
|
305
|
-
return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
|
|
306
|
-
}
|
|
107
|
+
return _dateToISOString[_DYN_CALL /* @min:%2ecall */](date);
|
|
307
108
|
}
|
|
308
|
-
|
|
309
|
-
* Convert a date to I.S.O. format in IE8
|
|
310
|
-
*/
|
|
311
|
-
export function _toISOStringPoly(date) {
|
|
312
|
-
if (date && date.getUTCFullYear) {
|
|
313
|
-
var pad = function (num) {
|
|
314
|
-
var r = String(num);
|
|
315
|
-
if (r[_DYN_LENGTH /* @min:%2elength */] === 1) {
|
|
316
|
-
r = "0" + r;
|
|
317
|
-
}
|
|
318
|
-
return r;
|
|
319
|
-
};
|
|
320
|
-
return date.getUTCFullYear()
|
|
321
|
-
+ "-" + pad(date.getUTCMonth() + 1)
|
|
322
|
-
+ "-" + pad(date.getUTCDate())
|
|
323
|
-
+ "T" + pad(date.getUTCHours())
|
|
324
|
-
+ ":" + pad(date.getUTCMinutes())
|
|
325
|
-
+ ":" + pad(date.getUTCSeconds())
|
|
326
|
-
+ "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
|
|
327
|
-
+ "Z";
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Performs the specified action for each element in an array. This helper exists to avoid adding a polyfil for older browsers
|
|
332
|
-
* that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype
|
|
333
|
-
* implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would
|
|
334
|
-
* cause a testing requirement to test with and without the implementations
|
|
335
|
-
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop
|
|
336
|
-
* @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
|
337
|
-
*/
|
|
338
|
-
export function arrForEach(arr, callbackfn, thisArg) {
|
|
339
|
-
var len = arr[_DYN_LENGTH /* @min:%2elength */];
|
|
340
|
-
try {
|
|
341
|
-
for (var idx = 0; idx < len; idx++) {
|
|
342
|
-
if (idx in arr) {
|
|
343
|
-
if (callbackfn[_DYN_CALL /* @min:%2ecall */](thisArg || arr, arr[idx], idx, arr) === -1) {
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
catch (e) {
|
|
350
|
-
// This can happen with some native browser objects, but should not happen for the type we are checking for
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers
|
|
355
|
-
* that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype
|
|
356
|
-
* implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would
|
|
357
|
-
* cause a testing requirement to test with and without the implementations
|
|
358
|
-
* @param searchElement The value to locate in the array.
|
|
359
|
-
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
|
|
360
|
-
*/
|
|
361
|
-
export function arrIndexOf(arr, searchElement, fromIndex) {
|
|
362
|
-
if (arr) {
|
|
363
|
-
// For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
|
|
364
|
-
if (arr[strIndexOf]) {
|
|
365
|
-
return arr[strIndexOf](searchElement, fromIndex);
|
|
366
|
-
}
|
|
367
|
-
var len = arr[_DYN_LENGTH /* @min:%2elength */];
|
|
368
|
-
var from = fromIndex || 0;
|
|
369
|
-
try {
|
|
370
|
-
for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {
|
|
371
|
-
if (lp in arr && arr[lp] === searchElement) {
|
|
372
|
-
return lp;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
catch (e) {
|
|
377
|
-
// This can happen with some native browser objects, but should not happen for the type we are checking for
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
return -1;
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Calls a defined callback function on each element of an array, and returns an array that contains the results. This helper exists
|
|
384
|
-
* to avoid adding a polyfil for older browsers that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page
|
|
385
|
-
* checks for presence/absence of the prototype implementation. Note: For consistency this will not use the Array.prototype.xxxx
|
|
386
|
-
* implementation if it exists as this would cause a testing requirement to test with and without the implementations
|
|
387
|
-
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
|
|
388
|
-
* @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.
|
|
389
|
-
*/
|
|
390
|
-
export function arrMap(arr, callbackfn, thisArg) {
|
|
391
|
-
var results;
|
|
392
|
-
if (arr) {
|
|
393
|
-
// For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
|
|
394
|
-
if (arr[strMap]) {
|
|
395
|
-
return arr[strMap](callbackfn, thisArg);
|
|
396
|
-
}
|
|
397
|
-
var len = arr[_DYN_LENGTH /* @min:%2elength */];
|
|
398
|
-
var _this = thisArg || arr;
|
|
399
|
-
results = new Array(len);
|
|
400
|
-
try {
|
|
401
|
-
for (var lp = 0; lp < len; lp++) {
|
|
402
|
-
if (lp in arr) {
|
|
403
|
-
results[lp] = callbackfn[_DYN_CALL /* @min:%2ecall */](_this, arr[lp], arr);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
catch (e) {
|
|
408
|
-
// This can happen with some native browser objects, but should not happen for the type we are checking for
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
return results;
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is
|
|
415
|
-
* provided as an argument in the next call to the callback function. This helper exists to avoid adding a polyfil for older browsers that do not define
|
|
416
|
-
* Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype implementation. Note: For consistency
|
|
417
|
-
* this will not use the Array.prototype.xxxx implementation if it exists as this would cause a testing requirement to test with and without the implementations
|
|
418
|
-
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
|
|
419
|
-
* @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.
|
|
420
|
-
*/
|
|
421
|
-
export function arrReduce(arr, callbackfn, initialValue) {
|
|
422
|
-
var value;
|
|
423
|
-
if (arr) {
|
|
424
|
-
// For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
|
|
425
|
-
if (arr[strReduce]) {
|
|
426
|
-
return arr[strReduce](callbackfn, initialValue);
|
|
427
|
-
}
|
|
428
|
-
var len = arr[_DYN_LENGTH /* @min:%2elength */];
|
|
429
|
-
var lp = 0;
|
|
430
|
-
// Specifically checking the number of passed arguments as the value could be anything
|
|
431
|
-
if (arguments[_DYN_LENGTH /* @min:%2elength */] >= 3) {
|
|
432
|
-
value = arguments[2];
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
while (lp < len && !(lp in arr)) {
|
|
436
|
-
lp++;
|
|
437
|
-
}
|
|
438
|
-
value = arr[lp++];
|
|
439
|
-
}
|
|
440
|
-
while (lp < len) {
|
|
441
|
-
if (lp in arr) {
|
|
442
|
-
value = callbackfn(value, arr[lp], lp, arr);
|
|
443
|
-
}
|
|
444
|
-
lp++;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
return value;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* helper method to trim strings (IE8 does not implement String.prototype.trim)
|
|
451
|
-
*/
|
|
452
|
-
export function strTrim(str) {
|
|
453
|
-
if (str) {
|
|
454
|
-
// For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
|
|
455
|
-
str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str[_DYN_REPLACE /* @min:%2ereplace */] ? str[_DYN_REPLACE /* @min:%2ereplace */](/^\s+|\s+$/g, STR_EMPTY) : str);
|
|
456
|
-
}
|
|
457
|
-
return str;
|
|
458
|
-
}
|
|
459
|
-
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
460
|
-
var _objKeysDontEnums = [
|
|
461
|
-
"toString",
|
|
462
|
-
"toLocaleString",
|
|
463
|
-
"valueOf",
|
|
464
|
-
"hasOwnProperty",
|
|
465
|
-
"isPrototypeOf",
|
|
466
|
-
"propertyIsEnumerable",
|
|
467
|
-
"constructor"
|
|
468
|
-
];
|
|
469
|
-
/**
|
|
470
|
-
* Returns the names of the enumerable string properties and methods of an object. This helper exists to avoid adding a polyfil for older browsers
|
|
471
|
-
* that do not define Object.keys eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.
|
|
472
|
-
* Note: For consistency this will not use the Object.keys implementation if it exists as this would cause a testing requirement to test with and without the implementations
|
|
473
|
-
* @param obj Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
|
474
|
-
*/
|
|
475
|
-
export function objKeys(obj) {
|
|
476
|
-
var objType = typeof obj;
|
|
477
|
-
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
478
|
-
throwTypeError("objKeys called on non-object");
|
|
479
|
-
}
|
|
480
|
-
// For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification
|
|
481
|
-
if (!_objKeysHasDontEnumBug && _objKeys) {
|
|
482
|
-
return _objKeys(obj);
|
|
483
|
-
}
|
|
484
|
-
var result = [];
|
|
485
|
-
for (var prop in obj) {
|
|
486
|
-
if (obj && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](obj, prop)) {
|
|
487
|
-
result[_DYN_PUSH /* @min:%2epush */](prop);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
if (_objKeysHasDontEnumBug) {
|
|
491
|
-
var dontEnumsLength = _objKeysDontEnums[_DYN_LENGTH /* @min:%2elength */];
|
|
492
|
-
for (var lp = 0; lp < dontEnumsLength; lp++) {
|
|
493
|
-
if (obj && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](obj, _objKeysDontEnums[lp])) {
|
|
494
|
-
result[_DYN_PUSH /* @min:%2epush */](_objKeysDontEnums[lp]);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
return result;
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Try to define get/set object property accessors for the target object/prototype, this will provide compatibility with
|
|
502
|
-
* existing API definition when run within an ES5+ container that supports accessors but still enable the code to be loaded
|
|
503
|
-
* and executed in an ES3 container, providing basic IE8 compatibility.
|
|
504
|
-
* @param target The object on which to define the property.
|
|
505
|
-
* @param prop The name of the property to be defined or modified.
|
|
506
|
-
* @param getProp The getter function to wire against the getter.
|
|
507
|
-
* @param setProp The setter function to wire against the setter.
|
|
508
|
-
* @returns True if it was able to create the accessors otherwise false
|
|
509
|
-
*/
|
|
510
|
-
export function objDefineAccessors(target, prop, getProp, setProp) {
|
|
511
|
-
if (_objDefineProperty) {
|
|
512
|
-
try {
|
|
513
|
-
var descriptor = {
|
|
514
|
-
enumerable: true,
|
|
515
|
-
configurable: true
|
|
516
|
-
};
|
|
517
|
-
if (getProp) {
|
|
518
|
-
descriptor.get = getProp;
|
|
519
|
-
}
|
|
520
|
-
if (setProp) {
|
|
521
|
-
descriptor.set = setProp;
|
|
522
|
-
}
|
|
523
|
-
_objDefineProperty(target, prop, descriptor);
|
|
524
|
-
return true;
|
|
525
|
-
}
|
|
526
|
-
catch (e) {
|
|
527
|
-
// IE8 Defines a defineProperty on Object but it's only supported for DOM elements so it will throw
|
|
528
|
-
// We will just ignore this here.
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
return false;
|
|
532
|
-
}
|
|
533
|
-
function _doNothing(value) {
|
|
534
|
-
return value;
|
|
535
|
-
}
|
|
536
|
-
export function deepFreeze(obj) {
|
|
537
|
-
if (_objFreeze) {
|
|
538
|
-
objForEachKey(obj, function (name, value) {
|
|
539
|
-
if (isArray(value) || isObject(value)) {
|
|
540
|
-
_objFreeze(value);
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
return objFreeze(obj);
|
|
545
|
-
}
|
|
546
|
-
export var objFreeze = _objFreeze || _doNothing;
|
|
547
|
-
export var objSeal = _objSeal || _doNothing;
|
|
109
|
+
export var deepFreeze = objDeepFreeze;
|
|
548
110
|
/**
|
|
549
111
|
* 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)
|
|
550
112
|
* https://caniuse.com/#search=Date.now
|
|
@@ -613,15 +175,6 @@ export function getSetValue(target, field, defValue) {
|
|
|
613
175
|
export function getCfgValue(theValue, defaultValue) {
|
|
614
176
|
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
615
177
|
}
|
|
616
|
-
export function isNotTruthy(value) {
|
|
617
|
-
return !value;
|
|
618
|
-
}
|
|
619
|
-
export function isTruthy(value) {
|
|
620
|
-
return !!value;
|
|
621
|
-
}
|
|
622
|
-
export function throwError(message) {
|
|
623
|
-
throw new Error(message);
|
|
624
|
-
}
|
|
625
178
|
function _createProxyFunction(source, funcName) {
|
|
626
179
|
var srcFunc = null;
|
|
627
180
|
var src = null;
|
|
@@ -669,7 +222,7 @@ export function proxyAssign(target, source, chkSet) {
|
|
|
669
222
|
}
|
|
670
223
|
}
|
|
671
224
|
else if (!chkSet || chkSet(field, false, source, target)) {
|
|
672
|
-
if (
|
|
225
|
+
if (objHasOwnProperty(target, field)) {
|
|
673
226
|
// Remove any previous instance property
|
|
674
227
|
delete target[field];
|
|
675
228
|
}
|
|
@@ -735,10 +288,10 @@ export function proxyFunctions(target, source, functionsToProxy, overwriteTarget
|
|
|
735
288
|
export function createClassFromInterface(defaults) {
|
|
736
289
|
return /** @class */ (function () {
|
|
737
290
|
function class_1() {
|
|
738
|
-
var
|
|
291
|
+
var _this = this;
|
|
739
292
|
if (defaults) {
|
|
740
293
|
objForEachKey(defaults, function (field, value) {
|
|
741
|
-
|
|
294
|
+
_this[field] = value;
|
|
742
295
|
});
|
|
743
296
|
}
|
|
744
297
|
}
|