@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
1 lines • 121 kB
Source Map (JSON)
{"version":3,"sources":["../../../packages/core/base/utilities.ts"],"names":[],"mappings":"AAIA,kBAAU,OAAO,CAAC;IAmBd,SAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAI/E;IAGM,MAAM,SAAS,gBADU,GAAG,EAAE,KAAK,GAAG,UAAU,GAAG,QAAQ,GAAG,EAAE,GAAG,UAAU,KAAK,GACtD,CAAC;IAC7B,MAAM,YAAY,gBAFO,GAAG,EAAE,KAAK,GAAG,UAAU,GAAG,QAAQ,GAAG,EAAE,GAAG,UAAU,KAAK,GAEnD,CAAC;IAqCvC,MAAa,mBAAmB;QAC5B;;;;WAIG;eACW,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO;QAQvD;;;;WAIG;eACW,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;QASxE;;;;WAIG;eACW,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;QAW3D;;;WAGG;eACW,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;QAS5D;;WAEG;eACW,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;QAS1C;;WAEG;eACW,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;eAelC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;KAW/D;IAED,MAAa,qBAAqB;QAC9B;;;WAGG;eACW,iBAAiB,IAAI,OAAO;QAQ1C;;;;WAIG;eACW,OAAO,CAAC,GAA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;IAED;;;;OAIG;IACH,SAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG3D;IAED;;;;;OAKG;IACH,SAAgB,UAAU,CAAC,CAAC,KAAK,CAAC,CAMjC;IAED;;;;;;;OAOG;IACH,SAAgB,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAMvC;IAED;;;OAGG;IACH,SAAgB,SAAS,IAAI,MAAM,CAGlC;IAED;;OAEG;IACH,SAAgB,IAAI,IAAI,OAAO,CAAC,oBAAoB,CAgBnD;IAED;;OAEG;IACH,SAAgB,aAAa,IAAI,MAAM,CAWtC;IAED;;OAEG;IACH,SAAgB,cAAc,IAAI,OAAO,CAExC;IAED;;OAEG;IACH,SAAgB,OAAO,IAAI,OAAO,CAEjC;IAED;;OAEG;IACH,SAAgB,WAAW,IAAI,OAAO,CAErC;IAED;;;;;;;;;OASG;IACH,SAAgB,cAAc,IAAI,MAAM,CAEvC;IAED;;OAEG;IACH,SAAgB,IAAI,IAAI,IAAI,CAmC3B;IAED;;OAEG;IACH,SAAgB,YAAY,IAAI,IAAI,CAUnC;CA0HJ","file":"utilities.d.ts","sourcesContent":["/* eslint-disable unused-imports/no-unused-vars */\r\n/* eslint-disable no-console */\r\n/* eslint-disable max-len */\r\n// this code has been worked on other platform, and refactoring may cause other problem so keeps as is.\r\nnamespace MsftSme {\r\n 'use strict';\r\n\r\n const global: any = window;\r\n const FunctionGlobal = Function;\r\n const MathGlobal = Math;\r\n const ObjectGlobal = Object;\r\n\r\n // See Mark Miller’s explanation of what this does.\r\n // http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming\r\n //\r\n // For example:\r\n // const array_slice: <T>(target: T[]|IArguments, start?: number, end?: number) => T[] = MsPortalFx.uncurryThis(Array.prototype.slice);\r\n // Then the call can be strong typed, rather than call/apply with only runtime check.\r\n //\r\n // This also **might** have the nice side-effect of reducing the size of\r\n // the minified code by reducing x.call() to merely x()\r\n const call = FunctionGlobal.call;\r\n const apply = FunctionGlobal.apply;\r\n export function uncurryThis(f: (...args: any[]) => any): (...args: any[]) => any {\r\n return function () {\r\n return call.apply(f, arguments);\r\n };\r\n }\r\n\r\n const _applyCall: (f: (...args: any[]) => any, target: any, args: any[] | IArguments) => any = uncurryThis(apply);\r\n export const applyCall = _applyCall;\r\n export const applyUncurry = _applyCall; // most uncurry function can be call by _applyCall except for array_concat; (see below.)\r\n\r\n // declare variable such that minimize better and code readibility\r\n const array_prototype = Array.prototype;\r\n const array_prototype_concat = array_prototype.concat; // array concat does not work well with uncurryThis since it flatten the arguments array.\r\n const array_prototype_push = array_prototype.push;\r\n const array_filter: <T>(target: T[] | IArguments, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any) => T[] = uncurryThis(array_prototype.filter);\r\n const array_forEach: <T>(target: T[] | IArguments, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any) => void = uncurryThis(array_prototype.forEach);\r\n const array_join: <T>(target: T[] | IArguments, separator?: string) => string = uncurryThis(array_prototype.join);\r\n const array_push: <T>(target: T[] | IArguments, item: T) => number = uncurryThis(array_prototype_push);\r\n const array_slice: <T>(target: T[] | IArguments, start?: number, end?: number) => T[] = uncurryThis(array_prototype.slice);\r\n const array_splice: <T>(target: T[] | IArguments, start: number, deleteCount?: number, ...items: T[]) => T[] = uncurryThis(array_prototype.splice);\r\n // eslint-disable-next-line unused-imports/no-unused-vars\r\n const array_indexof: <T>(target: T[] | IArguments, searchElement: T, fromIndex?: number) => number = uncurryThis(array_prototype.indexOf);\r\n\r\n const array_isArray = Array.isArray;\r\n\r\n const string_prototype = String.prototype;\r\n const string_concat: (target: string, ...items: string[]) => string = uncurryThis(string_prototype.concat);\r\n const string_split: (target: string, separator: string, limit?: number) => string[] = uncurryThis(string_prototype.split);\r\n const string_substring: (target: string, start: number, end?: number) => string = uncurryThis(string_prototype.substring);\r\n const string_indexOf: (target: string, searchString: string, position?: number) => number = uncurryThis(string_prototype.indexOf);\r\n const string_toLowerCase: (target: string) => string = uncurryThis(string_prototype.toLowerCase);\r\n\r\n const object_hasOwnProperty: (target: Object, v: string) => boolean = uncurryThis(ObjectGlobal.prototype.hasOwnProperty);\r\n const object_propertyIsEnumerable: (target: Object, v: PropertyKey) => boolean = uncurryThis(ObjectGlobal.prototype.propertyIsEnumerable);\r\n const object_keys_original = ObjectGlobal.keys;\r\n const _undefined: any = undefined;\r\n\r\n const object_freeze = ObjectGlobal.freeze;\r\n\r\n const functionType = \"function\";\r\n const stringType = \"string\";\r\n const numberType = \"number\";\r\n const objectType = \"object\";\r\n const undefinedType = \"undefined\";\r\n\r\n export class LocalStorageHandler {\r\n /**\r\n * Gets the local storage.\r\n * @param window the window object to get local storage from.\r\n * @returns The local storage.\r\n */\r\n public static getLocalStorage(window?: Window): Storage {\r\n try {\r\n return window ? window.localStorage : localStorage;\r\n } catch (error) {\r\n console.warn('Error getting the localStorage:', error);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the value for the localStorage by key.\r\n * @param key The key to set value.\r\n * @param value The value for the key.\r\n */\r\n public static setItem(key: string, value: string, window?: Window): void {\r\n try {\r\n const localStorageTarget = window ? window.localStorage : localStorage;\r\n localStorageTarget.setItem(key, value);\r\n } catch (error) {\r\n console.warn('Error saving to localStorage:', error);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the value from localStorage by key.\r\n * @param key The key to get value.\r\n * @returns The value for the key passed in.\r\n */\r\n public static getItem(key: string, window?: Window): string {\r\n try {\r\n const localStorageTarget = window ? window.localStorage : localStorage;\r\n return localStorageTarget.getItem(key);\r\n } catch (error) {\r\n console.warn('Error retrieving from localStorage:', error);\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Removes the value for the localStorage by key.\r\n * @param key The key to remove value.\r\n */\r\n public static removeItem(key: string, window?: Window): void {\r\n try {\r\n const localStorageTarget = window ? window.localStorage : localStorage;\r\n localStorageTarget.removeItem(key);\r\n } catch (error) {\r\n console.warn('Error removing from localStorage:', error);\r\n }\r\n }\r\n\r\n /**\r\n * Clears the current localStorage.\r\n */\r\n public static clear(window?: Window): void {\r\n try {\r\n const localStorageTarget = window ? window.localStorage : localStorage;\r\n localStorageTarget.clear();\r\n } catch (error) {\r\n console.warn('Error clearing localStorage:', error);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the length of the local storage\r\n */\r\n public static getLength(window?: Window): number {\r\n let length: number;\r\n try {\r\n const localStorageTarget = window ? window.localStorage : localStorage;\r\n length = localStorageTarget.length;\r\n } catch (error) {\r\n console.warn('Error getting localStorage length:', error);\r\n }\r\n\r\n return length;\r\n }\r\n\r\n /*\r\n * Gets the key by index.\r\n */\r\n public static getKey(index: number, window?: Window): string {\r\n let value: string;\r\n try {\r\n const localStorageTarget = window ? window.localStorage : localStorage;\r\n value = localStorageTarget.key(index);\r\n } catch (error) {\r\n console.warn('Error getting value from localStorage by key:', error);\r\n }\r\n\r\n return value;\r\n }\r\n }\r\n\r\n export class SessionStorageHandler {\r\n /**\r\n * Gets the session storage.\r\n * @returns The session storage.\r\n */\r\n public static getSessionStorage(): Storage {\r\n try {\r\n return sessionStorage;\r\n } catch (error) {\r\n console.warn('Error getting the sessionStorage:', error);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the value for the sessionStorage by key.\r\n * @param key The key to set value.\r\n * @param value The value for the key.\r\n */\r\n public static setItem(key: string, value: string): void {\r\n try {\r\n SessionStorageHandler.getSessionStorage().setItem(key, value);\r\n } catch (error) {\r\n console.warn('Error saving to sessionStorage:', error);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the value from sessionStorage by key.\r\n * @param sessionStorageTarget The sessionStorage to use.\r\n * @param key The key to get value.\r\n * @returns The value for the key passed in.\r\n */\r\n public static getItem(key: string): string {\r\n try {\r\n return SessionStorageHandler.getSessionStorage().getItem(key);\r\n } catch (error) {\r\n console.warn('Error retrieving from sessionStorage:', error);\r\n }\r\n\r\n return '{}';\r\n }\r\n\r\n /**\r\n * Removes the value for the sessionStorage by key.\r\n * @param sessionStorageTarget The sessionStorage to use.\r\n * @param key The key to remove value.\r\n */\r\n public static removeItem(key: string): void {\r\n try {\r\n SessionStorageHandler.getSessionStorage().removeItem(key);\r\n } catch (error) {\r\n console.warn('Error removing from sessionStorage:', error);\r\n }\r\n }\r\n\r\n /**\r\n * Clears the current sessionStorage.\r\n * @param sessionStorageTarget The sessionStorage to use.\r\n */\r\n public static clear(): void {\r\n try {\r\n SessionStorageHandler.getSessionStorage().clear();\r\n } catch (error) {\r\n console.warn('Error clearing sessionStorage:', error);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the length of the sessionStorage\r\n * @param sessionStorageTarget The sessionStorage to use.\r\n * @returns\r\n */\r\n public static getLength(): number {\r\n let length: number;\r\n try {\r\n length = SessionStorageHandler.getSessionStorage().length;\r\n } catch (error) {\r\n console.warn('Error getting sessionStorage length:', error);\r\n }\r\n\r\n return length;\r\n }\r\n\r\n /* Gets the key by index.\r\n * @param sessionStorageTarget The sessionStorage to use.\r\n * @returns\r\n */\r\n public static getKey(index: number): string {\r\n let value: string;\r\n try {\r\n value = SessionStorageHandler.getSessionStorage().key(index);\r\n } catch (error) {\r\n console.warn('Error getting value from sessionStorage by key:', error);\r\n }\r\n\r\n return value;\r\n }\r\n }\r\n\r\n /**\r\n * For testing only. Use Object.keys.\r\n */\r\n export function _objectKeysPolyfill(o: any) {\r\n switch (typeof o) {\r\n case stringType:\r\n const arr: string[] = [];\r\n for (let i in o) {\r\n array_push(arr, i);\r\n }\r\n return arr;\r\n case functionType:\r\n case objectType:\r\n case undefinedType:\r\n return object_keys_original(o);\r\n default: // probably some other native type\r\n return [];\r\n }\r\n }\r\n\r\n // intentionally put inside an anonymous function.\r\n // Presence of try-catch impacts the browser's ability\r\n // to optimize code in the same function context.\r\n (() => {\r\n try {\r\n object_keys_original(\"\");\r\n } catch (err) {\r\n // it threw so this browser is in ES5 mode (probably IE11)\r\n // let's polyfill Object.keys\r\n ObjectGlobal.keys = _objectKeysPolyfill;\r\n }\r\n })();\r\n\r\n const object_keys = ObjectGlobal.keys;\r\n\r\n function isTypeOf(obj: any, type: string) {\r\n return typeof obj === type;\r\n }\r\n\r\n function isDate(obj: any) {\r\n return obj instanceof Date;\r\n }\r\n\r\n export function isFunction(obj: any): boolean {\r\n return isTypeOf(obj, functionType);\r\n }\r\n\r\n export function isNumber(obj: any): boolean {\r\n return isTypeOf(obj, numberType);\r\n }\r\n\r\n const regex_NonSpace = /\\S/;\r\n const regex_WhiteSpace = /\\s/;\r\n\r\n function getDisposeFunc(value: any): Func<void> {\r\n let dispose = value && value.dispose;\r\n return isTypeOf(dispose, functionType) && dispose;\r\n }\r\n\r\n export function forEachKey<T>(obj: StringMap<T>, iterator: (key: string, value: T) => void): void;\r\n export function forEachKey<T>(obj: NumberMap<T>, iterator: (key: number, value: T) => void): void;\r\n export function forEachKey<T>(obj: any, iterator: (key: any, value: T) => void): void {\r\n array_forEach(object_keys(obj), (k) => {\r\n iterator(k, obj[k]);\r\n });\r\n }\r\n\r\n /**\r\n * Shortcut for Object.keys(obj || {}).length.\r\n * @return number.\r\n */\r\n export function keysLength(obj: Object) {\r\n return object_keys(obj || {}).length;\r\n }\r\n\r\n /**\r\n * Determines whether an object has properties on it.\r\n * Will return true for the following inputs: [], {}, \"\", 0, 1, true, false, new Date(), function() {}.\r\n * Will return false for the following inputs: [1], {a:1}, \"123\".\r\n * @return boolean.\r\n */\r\n export function isEmpty(obj: Object) {\r\n return !keysLength(obj);\r\n }\r\n\r\n /**\r\n * Detect a value is Disposable.\r\n *\r\n * @param value The value to check against value.dispose is a function.\r\n * @return boolean.\r\n */\r\n export function isDisposable(value: any): boolean {\r\n return !!getDisposeFunc(value);\r\n }\r\n\r\n function _disposeDisposable(value: any): void {\r\n if (array_isArray(value)) {\r\n array_forEach(value, _disposeDisposable);\r\n }\r\n\r\n const dispose = getDisposeFunc(value);\r\n if (dispose) {\r\n dispose.call(value); // dispose typically rely on this is the object.\r\n }\r\n }\r\n\r\n /**\r\n * call value.dispose() if a value is Disposable.\r\n *\r\n * @param value The value to call value.dispose()\r\n * @return boolean;\r\n */\r\n export const disposeDisposable: (...values: any[]) => void = function (/*...values: any[]*/) {\r\n array_forEach(arguments, _disposeDisposable);\r\n };\r\n\r\n /**\r\n * Detect a value is null.\r\n *\r\n * @param value The value to check against null.\r\n * @return boolean.\r\n */\r\n export function isNull(value: any): boolean {\r\n return value === null;\r\n }\r\n\r\n /**\r\n * Detect a value is undefined.\r\n *\r\n * @param value The value to check against undefined.\r\n * @return boolean.\r\n */\r\n export function isUndefined(value: any): boolean {\r\n return value === _undefined;\r\n }\r\n\r\n /**\r\n * Indicates whether the specified object is null or undefined.\r\n *\r\n * @param value The value to test.\r\n * @returns True if the value parameter is null or undefined; otherwise, false.\r\n */\r\n export function isNullOrUndefined(value: any): boolean {\r\n return value === null || value === _undefined;\r\n }\r\n\r\n /**\r\n * Indicates whether the specified object is not null or undefined.\r\n *\r\n * @param value The value to test.\r\n * @returns True if the value parameter is null or undefined; otherwise, false.\r\n */\r\n export function notNullOrUndefined(value: any): boolean {\r\n return value !== null && value !== _undefined;\r\n }\r\n\r\n /**\r\n * Checks if the string is null, undefined or whitespace.\r\n *\r\n * @param value The target string.\r\n * @return true if the string is null, undefined or whitespace; otherwise, false.\r\n */\r\n export function isNullOrWhiteSpace(value: string): boolean {\r\n // http://jsperf.com/empty-string-test-regex-vs-trim/4\r\n return isNullOrUndefined(value) || (isTypeOf(value, stringType) && !regex_NonSpace.test(value)); // if can't find any characters other than space.\r\n }\r\n\r\n /**\r\n * Checks if a string contains a white space\r\n *\r\n * Space, tab, line feed (newline), carriage return, form feed, and vertical tab characters are all\r\n * considered white space characters - https://learn.microsoft.com/en-us/cpp/c-language/white-space-characters?view=msvc-170\r\n * @param value the target string\r\n * @returns true if string contains a white space character else false\r\n */\r\n export function containsWhiteSpace(value: string): boolean {\r\n return regex_WhiteSpace.test(value);\r\n }\r\n\r\n //#region Array\r\n\r\n /**\r\n * Finds the index of the first element of an array that matches the predicate.\r\n *\r\n * @param predicate The Predicate function.\r\n * @param startIndex The starting index. If negative, it find from the end of the array.\r\n * If you want to continue the next search from the back you much pass in startIndex = (prevReturn - length -1)\r\n *\r\n * @return The first index that matches the predicate.\r\n */\r\n export function findIndex<T>(array: T[], predicate?: (value: T, index: number, array: T[]) => boolean, startIndex: number = 0): number {\r\n if (array) {\r\n let length = array.length;\r\n let stop = length;\r\n let step = 1;\r\n let index = startIndex;\r\n\r\n if (length) {\r\n if (startIndex < 0) {\r\n index += length;\r\n step = stop = -1;\r\n }\r\n if (!predicate) {\r\n return index < length && index >= 0 ? index : -1;\r\n }\r\n while (index !== stop) {\r\n if (predicate(array[index], index, array)) {\r\n return index;\r\n }\r\n index += step;\r\n }\r\n }\r\n }\r\n\r\n return -1;\r\n }\r\n\r\n /**\r\n * Finds the first element of an array that matches the predicate.\r\n *\r\n * @param predicate The Predicate function.\r\n * @param startIndex The starting index. If negative, it find from the end of the array.\r\n * If you want to continue the next search from the back you much pass in startIndex = (prevReturn - length -1)\r\n *\r\n * @return The first element that matches the predicate.\r\n */\r\n export function find<T>(array: T[], predicate?: (value: T, index: number, array: T[]) => boolean, startIndex?: number): T {\r\n const index = findIndex(array, predicate, startIndex);\r\n return index < 0 ? _undefined : array[index];\r\n }\r\n\r\n /**\r\n * Returns the first element of the sequence.\r\n *\r\n * @return The element\r\n */\r\n export function first<T>(array: T[]): T {\r\n return array ? array[0] : _undefined;\r\n }\r\n\r\n /**\r\n * Returns the last element of the sequence.\r\n *\r\n * @return The element\r\n */\r\n export function last<T>(array: T[]): T {\r\n const length = array ? array.length : 0;\r\n return length ? array[length - 1] : _undefined;\r\n }\r\n\r\n /**\r\n * Removes all values that equal the given item and returns them as an array\r\n *\r\n * @param item The value to be removed.\r\n * @return The removed items.\r\n */\r\n export function remove<T>(array: T[], itemOrPredicate: T | ((value: T) => boolean), startIndex: number = 0): T[] {\r\n const removedItems: T[] = [];\r\n let removedCount = 0;\r\n let predicate: (value: T) => boolean;\r\n\r\n if (isTypeOf(itemOrPredicate, functionType)) {\r\n predicate = <any>itemOrPredicate;\r\n }\r\n for (let i = startIndex, l = array.length; i < l; i++) {\r\n const item = array[i];\r\n if (removedCount) {\r\n array[i - removedCount] = item; //shift the item to the offset\r\n }\r\n if (itemOrPredicate === item || (predicate && predicate(item))) {\r\n removedCount++;\r\n array_push(removedItems, item);\r\n }\r\n }\r\n\r\n if (removedCount) {\r\n array_splice(array, -1 * removedCount); // remove that many item form the end;\r\n }\r\n\r\n return removedItems;\r\n }\r\n\r\n // This function use findIndex, put it here for minimizer friendly\r\n // sourceUnique is a flag to optimize the performance, set to true if you know source is unique already.\r\n export function pushUnique<T>(uniqueTarget: T[], source: T[], predicate?: (value1: T, value2: T) => boolean, sourceUnique = false): T[] {\r\n if (array_isArray(source)) {\r\n let getIndex = predicate ?\r\n (value: T) => findIndex(uniqueTarget, (resultValue) => predicate(resultValue, value)) :\r\n (value: T) => uniqueTarget.indexOf(value);\r\n let appendTarget = (sourceUnique) ? [] : uniqueTarget; // if source is already unique, we accumlate to a sperated array to increase the perf.\r\n for (let i = 0, l = source.length; i < l; i++) {\r\n let value = source[i];\r\n if (getIndex(value) < 0) {\r\n array_push(appendTarget, value);\r\n }\r\n }\r\n if (sourceUnique) { // if source is unique, we append to a uniqueTarget .\r\n array_prototype_push.apply(uniqueTarget, appendTarget);\r\n }\r\n }\r\n\r\n return uniqueTarget;\r\n }\r\n\r\n /**\r\n * Returns a unique set from this array based on the predicate.\r\n *\r\n * @param predicate The predicate function. Added to the result if the predicate returns false.\r\n * @return A new array with the unique values.\r\n */\r\n export function unique<T>(array: T[], predicate?: (value1: T, value2: T) => boolean): T[] {\r\n return pushUnique([], array, predicate);\r\n }\r\n\r\n /**\r\n * Returns a unique concatenated set from this array and the given array based on the predicate.\r\n *\r\n * @param arrays The list of arrays to get union of.\r\n * @return A new array with the unique values.\r\n */\r\n export function union<T>(...arrays: T[][]): T[];\r\n\r\n /**\r\n * Returns a unique concatenated set from this array and the given array based on the predicate.\r\n *\r\n * @param other The other array to concatenate with this one.\r\n * @param predicate The predicate function. Added to the result if the predicate returns false.\r\n * @return A new array with the unique values.\r\n */\r\n export function union<T>(array: T[], other: T[], predicate?: (value1: T, value2: T) => boolean): T[];\r\n export function union<T>(): T[] {\r\n const result: T[] = [];\r\n let lastArrayIndex = arguments.length - 2;\r\n let predicate = arguments[lastArrayIndex + 1];\r\n\r\n // If the predicate is not a function, it means that it is the last array to union.\r\n if (!isTypeOf(predicate, functionType)) {\r\n predicate = _undefined;\r\n lastArrayIndex++;\r\n }\r\n\r\n for (let i = 0; i <= lastArrayIndex; i++) {\r\n let source = unique(arguments[i], predicate); // make a smaller set\r\n pushUnique(result, source, predicate, true /* source Unique*/);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Merge multiple T, T[] into a combine T[] exclude null or undefined arguments.\r\n *\r\n * @param data, a list fo T, T[]\r\n * @returns concattenated array.\r\n */\r\n export const merge: <T>(...data: (T | T[])[]) => T[] = function <T>(/*...data: T[]*/): T[] {\r\n // Don't use TypeScript's built-in \"... rest\" args syntax for perf-critical\r\n // paths because it constructs the args array even if you don't need it,\r\n let ret: T[] = [];\r\n let data = array_filter(arguments, notNullOrUndefined);\r\n return array_prototype_concat.apply(ret, data);\r\n };\r\n\r\n /**\r\n * Projects each element of a sequence to a sequence and flattens the resulting sequences into one sequence.\r\n *\r\n * @param selector The projection function.\r\n * @return A flattened array.\r\n */\r\n export function mapMany<T, TResult>(array: T[], selector: (source: T) => TResult[]): TResult[] {\r\n return merge.apply(null, array.map(selector));\r\n }\r\n\r\n /**\r\n * Sorts an array using a stable sort algorithm.\r\n *\r\n * This method returns a new array, it does not sort in place.\r\n *\r\n * @param compare The Compare function.\r\n * @return Sorted array.\r\n */\r\n export function stableSort<T>(array: T[], compare: (a: T, b: T) => number): T[] {\r\n const array2 = array.map((v, i) => {\r\n return { i: i, v: v };\r\n });\r\n array2.sort((a, b) => {\r\n return compare(a.v, b.v) || (a.i - b.i);\r\n });\r\n return array2.map(v => v.v);\r\n }\r\n\r\n function toString<T>(item: T): string {\r\n return item ? item.toString() : String(item);\r\n }\r\n\r\n /**\r\n * Extends from a source array into an existing string map of key => item.\r\n *\r\n * @param objToExtend The target object to be extended.\r\n * @param sourceArray The source array to convert to a map properties of target object.\r\n * @param getKeyCallback The callback used to provide the key for the item.\r\n * @param getValueCallback The optional callback used to provide the key for the item, otherwise the item itself is used.\r\n * @param onlyIfNotExist If true, only Extend the value in array if the existing slot is still undefine. (This behaves like type script argument default value, it only fill in if the value is undefined.)\r\n *\r\n * @return The string map of key => item for the source array.\r\n */\r\n export function extendArrayIntoMap<T, U>(objToExtend: StringMap<U>, sourceItems: T[], getKeyCallback?: (item: T, index?: number) => string, getValueCallback?: (item: T, index?: number, key?: string) => U, onlyIfNotExist?: boolean): void;\r\n export function extendArrayIntoMap<T, U>(objToExtend: NumberMap<U>, sourceItems: T[], getKeyCallback?: (item: T, index?: number) => number, getValueCallback?: (item: T, index?: number, key?: string) => U, onlyIfNotExist?: boolean): void;\r\n export function extendArrayIntoMap<T, U>(objToExtend: any, sourceItems: T[], getKeyCallback?: (item: T, index?: number) => string | number, getValueCallback?: (item: T, index?: number, key?: string) => U, onlyIfNotExist?: boolean): void {\r\n getKeyCallback = getKeyCallback || toString;\r\n // The use of args here is to reduce the array creation call and make sure the function context this is the sourceItems.\r\n let args: any[] = [sourceItems, /*item*/, /*index*/, \"\"];\r\n for (let i = 0, l = sourceItems.length; i < l; i++) {\r\n let item = sourceItems[i];\r\n args[1] = item;\r\n args[2] = i;\r\n args[3] = _undefined;\r\n let key = call.apply(getKeyCallback, args);\r\n if (!onlyIfNotExist || objToExtend[key] === _undefined) {\r\n args[3] = key; // This is convient for the get value function to know the key that previous interpreted by getKeyCallback\r\n let value = getValueCallback ? call.apply(getValueCallback, args) : item;\r\n // Only extend this key if the value return is not undefined.\r\n if (value !== _undefined) {\r\n objToExtend[key] = value;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Extends from a source array into an existing string map of key => item.\r\n *\r\n * @param objToExtend The target object to be extended.\r\n * @param sourceArray The source array to convert to a map properties of target object.\r\n * @param getKeyCallback The callback used to provide the key for the item.\r\n * @param getValueCallback The optional callback used to provide the key for the item, otherwise the item itself is used.\r\n * @param onlyIfNotExist If true, only Extend the value in array if the existing slot is still undefine. (This behaves like type script argument default value, it only fill in if the value is undefined.)\r\n *\r\n * @return The string map of key => item for the source array.\r\n */\r\n export function extendStringMapIntoMap<T, U>(objToExtend: StringMap<U>, sourceItems: StringMap<T>, getValueCallback?: (item: T, key?: string) => U, onlyIfNotExist?: boolean): void;\r\n export function extendStringMapIntoMap<T, U>(objToExtend: any, sourceItems: StringMap<T>, getValueCallback?: (item: T, key?: string) => U, onlyIfNotExist?: boolean): void {\r\n // The use of args here is to reduce the array creation call and make sure the function context this is the sourceItems.\r\n let args: any[] = [sourceItems, /*item*/, /*key*/];\r\n\r\n forEachKey(sourceItems, (key, item) => {\r\n if (!onlyIfNotExist || objToExtend[key] === _undefined) {\r\n args[1] = item;\r\n args[2] = key; // This is convient for the get value function to know the key that previous interpreted by getKeyCallback\r\n let value = getValueCallback ? call.apply(getValueCallback, args) : (item || key);\r\n // Only extend this key if the value return is not undefined.\r\n if (value !== _undefined) {\r\n objToExtend[key] = value;\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Helper function to create a object lightweight constructor\r\n *\r\n * @param keys the ordered argument keys\r\n *\r\n * @return The function that will return string map base on the arguments index order of keys\r\n */\r\n export function getStringMapFunc(...keys: string[]): Func<StringMap<any>>;\r\n export function getStringMapFunc(keys: string[]): Func<StringMap<any>>;\r\n export function getStringMapFunc(keys: any): Func<StringMap<any>> {\r\n\r\n if (array_isArray(keys)) {\r\n // make a copy of keys so that future changes to the input array do not impact the behavior of the returned function.\r\n keys = array_slice(keys);\r\n } else {\r\n keys = arguments;\r\n }\r\n\r\n return function ( /* arguments*/) {\r\n // Most people call .hasOwnProperty or .constructor (which it should not)\r\n // since there is no guarantee that any object return to have those function -Expecially in generic function.\r\n // http://stackoverflow.com/questions/12017693/why-use-object-prototype-hasownproperty-callmyobj-prop-instead-of-myobj-hasow\r\n // Unfortunately, this need to be changed.\r\n let ret: StringMap<any> = {};\r\n array_forEach(arguments, (value, index) => {\r\n let key = keys[index];\r\n if (value !== _undefined) {\r\n ret[key] = value;\r\n }\r\n });\r\n return ret;\r\n };\r\n }\r\n\r\n /**\r\n * Helper funciton to create a object lightweight constructor\r\n *\r\n * @param keys the ordered argument keys\r\n *\r\n * @return The function that will return string map base on the arguments index order of keys\r\n */\r\n export function applyStringMapFunc(keys: string[]): Func<StringMap<any>> {\r\n return getStringMapFunc.apply(_undefined, keys);\r\n }\r\n\r\n /**\r\n * Helper funciton to create a object of type NameValue<N, T>\r\n *\r\n * @param name name\r\n * @param value value\r\n *\r\n * @return an object of NameValue<N, T>\r\n */\r\n export const getNameValue: <N, T>(name: N, value: T) => NameValue<N, T> = <any>getStringMapFunc(\"name\", \"value\");\r\n\r\n /**\r\n * Get a list of typeScript Enum into Array\r\n *\r\n * @param tsEnumeration The Type script Enum Array\r\n * @param sort optional whether to sort by enum's value\r\n * @return all NameValue<string, number>[] for this typeScriptEnum\r\n */\r\n export function getEnumArray(tsEnumeration: any, sort?: boolean): NameValue<string, number>[] {\r\n let retVal: { name: string; value: number }[] = [];\r\n\r\n forEachKey(<StringMap<number>>tsEnumeration, (key, val) => {\r\n if (isTypeOf(key, stringType) && isTypeOf(val, numberType)) {\r\n array_push(retVal, getNameValue(key, val));\r\n }\r\n });\r\n\r\n return sort ? retVal.sort((a, b) => {\r\n return a.value - b.value;\r\n }) : retVal;\r\n }\r\n\r\n /**\r\n * Coerce an input into an array if it isn't already one.\r\n */\r\n export function makeArray<T>(input: T | T[]): T[] {\r\n if (!array_isArray(input)) {\r\n if (isNullOrUndefined(input)) {\r\n input = [];\r\n } else {\r\n input = [<T>input];\r\n }\r\n }\r\n\r\n return <T[]>input;\r\n }\r\n\r\n //#endregion Array\r\n\r\n //#region Date\r\n\r\n /**\r\n * Checks if given dates are equal.\r\n *\r\n * @param left Left hand side date.\r\n * @param left Right hand side date.\r\n * @return True if left date is equal to right date.\r\n */\r\n export function areEqualDates(left: any, right: any): boolean {\r\n return isDate(left) && isDate(right) && !(left > right || left < right);\r\n }\r\n\r\n /**\r\n * Round down the date.getTime() to seconds\r\n *\r\n * @param date.\r\n * @return the getTime in seconds\r\n */\r\n export function toSeconds(date: Date): number {\r\n // The old function use toString to trim off microseconds to time comparsion for stablesort\r\n // return new Date(x.toString()).getTime(); --- this is slow:\r\n\r\n // http://jsperf.com/truncating-decimals\r\n // x = new Date()\r\n //Wed Feb 17 2016 12:15:39 GMT- 0800(Pacific Standard Time)\r\n //y = new Date(x.toString()).getTime()\r\n //1455740139000\r\n //z = (x.getTime() / 1000) | 0\r\n //1455740139\r\n return (date.getTime() / 1000) | 0;\r\n }\r\n\r\n //#endregion Date\r\n\r\n //#region Math\r\n\r\n const hexCharsLowerCase = string_split(\"0123456789abcdef\", \"\");\r\n\r\n const hexBytesLower: string[] = [];\r\n array_forEach(hexCharsLowerCase, (upper) => {\r\n array_forEach(hexCharsLowerCase, (lower) => {\r\n array_push(hexBytesLower, upper + lower);\r\n });\r\n });\r\n\r\n const sizeOfGuidInBytes = 20;\r\n const tempUintArray = new Uint8Array(sizeOfGuidInBytes);\r\n const tempStringArray: string[] = new Array(sizeOfGuidInBytes);\r\n\r\n function applyAndOr(index: number, and: number, or: number) {\r\n const temp = tempUintArray[index] & and;\r\n tempUintArray[index] = temp | or;\r\n }\r\n\r\n ////// TODO: const globalCrypto = <Crypto>(window.crypto || (<any>window).msCrypto);\r\n const globalCrypto = <RandomSource>(window.crypto || (<any>window).msCrypto);\r\n\r\n // c.f. rfc4122 (UUID version 4 = xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx)\r\n // xx xx xx xx - xx xx - 4x xx - yx xx - xx xx xx xx xx xx\r\n // 00 11 22 33 4 55 66 7 88 99 10 11 12 13 14 15 16 17 18 19\r\n function newGuidCrypto(): string {\r\n globalCrypto.getRandomValues(tempUintArray);\r\n\r\n applyAndOr(8, 0x0F, 0x40); // set upper half of the 8th byte to 0x4\r\n applyAndOr(11, 0x3F, 0x80); // set the two most significant bits of the 11th byte to 10b\r\n\r\n for (let i = 0; i < sizeOfGuidInBytes; i++) {\r\n tempStringArray[i] = hexBytesLower[tempUintArray[i]];\r\n }\r\n\r\n tempStringArray[4] = tempStringArray[7] = tempStringArray[10] = tempStringArray[13] = \"-\";\r\n\r\n return applyUncurry(string_concat, \"\", tempStringArray);\r\n }\r\n\r\n /**\r\n * HelperReturns hex number string.\r\n *\r\n * @param len The number of the output string length\r\n * @return a hexnumber string of length len\r\n */\r\n function getRandomHexString(len: number