@itwin/core-bentley 3.6.0-dev.65 → 3.6.0-dev.66

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 (221) hide show
  1. package/lib/cjs/AccessToken.d.ts +10 -10
  2. package/lib/cjs/AccessToken.js +9 -9
  3. package/lib/cjs/AccessToken.js.map +1 -1
  4. package/lib/cjs/Assert.d.ts +25 -25
  5. package/lib/cjs/Assert.js +45 -45
  6. package/lib/cjs/Assert.js.map +1 -1
  7. package/lib/cjs/BeEvent.d.ts +81 -81
  8. package/lib/cjs/BeEvent.js +156 -156
  9. package/lib/cjs/BeEvent.js.map +1 -1
  10. package/lib/cjs/BeSQLite.d.ts +172 -170
  11. package/lib/cjs/BeSQLite.d.ts.map +1 -1
  12. package/lib/cjs/BeSQLite.js +185 -183
  13. package/lib/cjs/BeSQLite.js.map +1 -1
  14. package/lib/cjs/BentleyError.d.ts +378 -378
  15. package/lib/cjs/BentleyError.d.ts.map +1 -1
  16. package/lib/cjs/BentleyError.js +703 -702
  17. package/lib/cjs/BentleyError.js.map +1 -1
  18. package/lib/cjs/BentleyLoggerCategory.d.ts +11 -11
  19. package/lib/cjs/BentleyLoggerCategory.js +19 -19
  20. package/lib/cjs/BentleyLoggerCategory.js.map +1 -1
  21. package/lib/cjs/ByteStream.d.ts +110 -110
  22. package/lib/cjs/ByteStream.js +159 -159
  23. package/lib/cjs/ByteStream.js.map +1 -1
  24. package/lib/cjs/ClassUtils.d.ts +14 -14
  25. package/lib/cjs/ClassUtils.js +27 -27
  26. package/lib/cjs/ClassUtils.js.map +1 -1
  27. package/lib/cjs/Compare.d.ts +47 -47
  28. package/lib/cjs/Compare.js +75 -75
  29. package/lib/cjs/Compare.js.map +1 -1
  30. package/lib/cjs/CompressedId64Set.d.ts +134 -134
  31. package/lib/cjs/CompressedId64Set.js +428 -428
  32. package/lib/cjs/CompressedId64Set.js.map +1 -1
  33. package/lib/cjs/Dictionary.d.ts +125 -125
  34. package/lib/cjs/Dictionary.js +203 -203
  35. package/lib/cjs/Dictionary.js.map +1 -1
  36. package/lib/cjs/Disposable.d.ts +80 -80
  37. package/lib/cjs/Disposable.js +120 -120
  38. package/lib/cjs/Disposable.js.map +1 -1
  39. package/lib/cjs/Id.d.ts +285 -285
  40. package/lib/cjs/Id.js +643 -643
  41. package/lib/cjs/Id.js.map +1 -1
  42. package/lib/cjs/IndexMap.d.ts +65 -65
  43. package/lib/cjs/IndexMap.js +91 -91
  44. package/lib/cjs/IndexMap.js.map +1 -1
  45. package/lib/cjs/JsonSchema.d.ts +77 -77
  46. package/lib/cjs/JsonSchema.js +9 -9
  47. package/lib/cjs/JsonSchema.js.map +1 -1
  48. package/lib/cjs/JsonUtils.d.ts +78 -78
  49. package/lib/cjs/JsonUtils.js +151 -151
  50. package/lib/cjs/JsonUtils.js.map +1 -1
  51. package/lib/cjs/LRUMap.d.ts +129 -129
  52. package/lib/cjs/LRUMap.js +333 -333
  53. package/lib/cjs/LRUMap.js.map +1 -1
  54. package/lib/cjs/Logger.d.ts +143 -143
  55. package/lib/cjs/Logger.js +258 -258
  56. package/lib/cjs/Logger.js.map +1 -1
  57. package/lib/cjs/ObservableSet.d.ts +23 -23
  58. package/lib/cjs/ObservableSet.js +51 -51
  59. package/lib/cjs/ObservableSet.js.map +1 -1
  60. package/lib/cjs/OneAtATimeAction.d.ts +31 -31
  61. package/lib/cjs/OneAtATimeAction.js +94 -94
  62. package/lib/cjs/OneAtATimeAction.js.map +1 -1
  63. package/lib/cjs/OrderedId64Iterable.d.ts +74 -74
  64. package/lib/cjs/OrderedId64Iterable.js +235 -235
  65. package/lib/cjs/OrderedId64Iterable.js.map +1 -1
  66. package/lib/cjs/OrderedSet.d.ts +40 -40
  67. package/lib/cjs/OrderedSet.js +64 -64
  68. package/lib/cjs/OrderedSet.js.map +1 -1
  69. package/lib/cjs/PriorityQueue.d.ts +70 -70
  70. package/lib/cjs/PriorityQueue.js +140 -140
  71. package/lib/cjs/PriorityQueue.js.map +1 -1
  72. package/lib/cjs/ProcessDetector.d.ts +59 -59
  73. package/lib/cjs/ProcessDetector.js +71 -71
  74. package/lib/cjs/ProcessDetector.js.map +1 -1
  75. package/lib/cjs/SortedArray.d.ts +232 -232
  76. package/lib/cjs/SortedArray.js +303 -303
  77. package/lib/cjs/SortedArray.js.map +1 -1
  78. package/lib/cjs/StatusCategory.d.ts +30 -30
  79. package/lib/cjs/StatusCategory.js +460 -460
  80. package/lib/cjs/StatusCategory.js.map +1 -1
  81. package/lib/cjs/StringUtils.d.ts +22 -22
  82. package/lib/cjs/StringUtils.js +148 -148
  83. package/lib/cjs/StringUtils.js.map +1 -1
  84. package/lib/cjs/Time.d.ts +122 -122
  85. package/lib/cjs/Time.js +152 -152
  86. package/lib/cjs/Time.js.map +1 -1
  87. package/lib/cjs/Tracing.d.ts +40 -40
  88. package/lib/cjs/Tracing.js +130 -130
  89. package/lib/cjs/Tracing.js.map +1 -1
  90. package/lib/cjs/TupleKeyedMap.d.ts +36 -36
  91. package/lib/cjs/TupleKeyedMap.js +102 -102
  92. package/lib/cjs/TupleKeyedMap.js.map +1 -1
  93. package/lib/cjs/TypedArrayBuilder.d.ts +155 -155
  94. package/lib/cjs/TypedArrayBuilder.js +208 -208
  95. package/lib/cjs/TypedArrayBuilder.js.map +1 -1
  96. package/lib/cjs/UnexpectedErrors.d.ts +43 -43
  97. package/lib/cjs/UnexpectedErrors.js +68 -68
  98. package/lib/cjs/UnexpectedErrors.js.map +1 -1
  99. package/lib/cjs/UtilityTypes.d.ts +96 -96
  100. package/lib/cjs/UtilityTypes.js +40 -40
  101. package/lib/cjs/UtilityTypes.js.map +1 -1
  102. package/lib/cjs/YieldManager.d.ts +18 -18
  103. package/lib/cjs/YieldManager.js +34 -34
  104. package/lib/cjs/YieldManager.js.map +1 -1
  105. package/lib/cjs/core-bentley.d.ts +74 -74
  106. package/lib/cjs/core-bentley.js +90 -90
  107. package/lib/cjs/core-bentley.js.map +1 -1
  108. package/lib/cjs/partitionArray.d.ts +21 -21
  109. package/lib/cjs/partitionArray.js +43 -43
  110. package/lib/cjs/partitionArray.js.map +1 -1
  111. package/lib/esm/AccessToken.d.ts +10 -10
  112. package/lib/esm/AccessToken.js +8 -8
  113. package/lib/esm/AccessToken.js.map +1 -1
  114. package/lib/esm/Assert.d.ts +25 -25
  115. package/lib/esm/Assert.js +41 -41
  116. package/lib/esm/Assert.js.map +1 -1
  117. package/lib/esm/BeEvent.d.ts +81 -81
  118. package/lib/esm/BeEvent.js +150 -150
  119. package/lib/esm/BeEvent.js.map +1 -1
  120. package/lib/esm/BeSQLite.d.ts +172 -170
  121. package/lib/esm/BeSQLite.d.ts.map +1 -1
  122. package/lib/esm/BeSQLite.js +182 -180
  123. package/lib/esm/BeSQLite.js.map +1 -1
  124. package/lib/esm/BentleyError.d.ts +378 -378
  125. package/lib/esm/BentleyError.d.ts.map +1 -1
  126. package/lib/esm/BentleyError.js +699 -698
  127. package/lib/esm/BentleyError.js.map +1 -1
  128. package/lib/esm/BentleyLoggerCategory.d.ts +11 -11
  129. package/lib/esm/BentleyLoggerCategory.js +16 -16
  130. package/lib/esm/BentleyLoggerCategory.js.map +1 -1
  131. package/lib/esm/ByteStream.d.ts +110 -110
  132. package/lib/esm/ByteStream.js +155 -155
  133. package/lib/esm/ByteStream.js.map +1 -1
  134. package/lib/esm/ClassUtils.d.ts +14 -14
  135. package/lib/esm/ClassUtils.js +22 -22
  136. package/lib/esm/ClassUtils.js.map +1 -1
  137. package/lib/esm/Compare.d.ts +47 -47
  138. package/lib/esm/Compare.js +63 -63
  139. package/lib/esm/Compare.js.map +1 -1
  140. package/lib/esm/CompressedId64Set.d.ts +134 -134
  141. package/lib/esm/CompressedId64Set.js +423 -423
  142. package/lib/esm/CompressedId64Set.js.map +1 -1
  143. package/lib/esm/Dictionary.d.ts +125 -125
  144. package/lib/esm/Dictionary.js +199 -199
  145. package/lib/esm/Dictionary.js.map +1 -1
  146. package/lib/esm/Disposable.d.ts +80 -80
  147. package/lib/esm/Disposable.js +112 -112
  148. package/lib/esm/Disposable.js.map +1 -1
  149. package/lib/esm/Id.d.ts +285 -285
  150. package/lib/esm/Id.js +639 -639
  151. package/lib/esm/Id.js.map +1 -1
  152. package/lib/esm/IndexMap.d.ts +65 -65
  153. package/lib/esm/IndexMap.js +86 -86
  154. package/lib/esm/IndexMap.js.map +1 -1
  155. package/lib/esm/JsonSchema.d.ts +77 -77
  156. package/lib/esm/JsonSchema.js +8 -8
  157. package/lib/esm/JsonSchema.js.map +1 -1
  158. package/lib/esm/JsonUtils.d.ts +78 -78
  159. package/lib/esm/JsonUtils.js +148 -148
  160. package/lib/esm/JsonUtils.js.map +1 -1
  161. package/lib/esm/LRUMap.d.ts +129 -129
  162. package/lib/esm/LRUMap.js +326 -326
  163. package/lib/esm/LRUMap.js.map +1 -1
  164. package/lib/esm/Logger.d.ts +143 -143
  165. package/lib/esm/Logger.js +253 -253
  166. package/lib/esm/Logger.js.map +1 -1
  167. package/lib/esm/ObservableSet.d.ts +23 -23
  168. package/lib/esm/ObservableSet.js +47 -47
  169. package/lib/esm/ObservableSet.js.map +1 -1
  170. package/lib/esm/OneAtATimeAction.d.ts +31 -31
  171. package/lib/esm/OneAtATimeAction.js +89 -89
  172. package/lib/esm/OneAtATimeAction.js.map +1 -1
  173. package/lib/esm/OrderedId64Iterable.d.ts +74 -74
  174. package/lib/esm/OrderedId64Iterable.js +232 -232
  175. package/lib/esm/OrderedId64Iterable.js.map +1 -1
  176. package/lib/esm/OrderedSet.d.ts +40 -40
  177. package/lib/esm/OrderedSet.js +59 -59
  178. package/lib/esm/OrderedSet.js.map +1 -1
  179. package/lib/esm/PriorityQueue.d.ts +70 -70
  180. package/lib/esm/PriorityQueue.js +136 -136
  181. package/lib/esm/PriorityQueue.js.map +1 -1
  182. package/lib/esm/ProcessDetector.d.ts +59 -59
  183. package/lib/esm/ProcessDetector.js +67 -67
  184. package/lib/esm/ProcessDetector.js.map +1 -1
  185. package/lib/esm/SortedArray.d.ts +232 -232
  186. package/lib/esm/SortedArray.js +296 -296
  187. package/lib/esm/SortedArray.js.map +1 -1
  188. package/lib/esm/StatusCategory.d.ts +30 -30
  189. package/lib/esm/StatusCategory.js +454 -454
  190. package/lib/esm/StatusCategory.js.map +1 -1
  191. package/lib/esm/StringUtils.d.ts +22 -22
  192. package/lib/esm/StringUtils.js +142 -142
  193. package/lib/esm/StringUtils.js.map +1 -1
  194. package/lib/esm/Time.d.ts +122 -122
  195. package/lib/esm/Time.js +146 -146
  196. package/lib/esm/Time.js.map +1 -1
  197. package/lib/esm/Tracing.d.ts +40 -40
  198. package/lib/esm/Tracing.js +126 -126
  199. package/lib/esm/Tracing.js.map +1 -1
  200. package/lib/esm/TupleKeyedMap.d.ts +36 -36
  201. package/lib/esm/TupleKeyedMap.js +98 -98
  202. package/lib/esm/TupleKeyedMap.js.map +1 -1
  203. package/lib/esm/TypedArrayBuilder.d.ts +155 -155
  204. package/lib/esm/TypedArrayBuilder.js +200 -200
  205. package/lib/esm/TypedArrayBuilder.js.map +1 -1
  206. package/lib/esm/UnexpectedErrors.d.ts +43 -43
  207. package/lib/esm/UnexpectedErrors.js +64 -64
  208. package/lib/esm/UnexpectedErrors.js.map +1 -1
  209. package/lib/esm/UtilityTypes.d.ts +96 -96
  210. package/lib/esm/UtilityTypes.js +34 -34
  211. package/lib/esm/UtilityTypes.js.map +1 -1
  212. package/lib/esm/YieldManager.d.ts +18 -18
  213. package/lib/esm/YieldManager.js +30 -30
  214. package/lib/esm/YieldManager.js.map +1 -1
  215. package/lib/esm/core-bentley.d.ts +74 -74
  216. package/lib/esm/core-bentley.js +78 -78
  217. package/lib/esm/core-bentley.js.map +1 -1
  218. package/lib/esm/partitionArray.d.ts +21 -21
  219. package/lib/esm/partitionArray.js +39 -39
  220. package/lib/esm/partitionArray.js.map +1 -1
  221. package/package.json +3 -3
@@ -1,15 +1,15 @@
1
- /** Check if class `subclass` is a different class from `superclass` but extends from `superclass`
2
- * @internal
3
- * @param subclass the class that may be a subclass of `superclass`
4
- * @param superclass the class that may be a base class of `subclass`
5
- * @returns whether `subclass` is a proper subclass of `superclass`
6
- */
7
- export declare function isProperSubclassOf<SuperClass extends new (..._: any[]) => any, NonSubClass extends new (..._: any[]) => any, SubClass extends new (..._: any[]) => InstanceType<SuperClass>>(subclass: SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass;
8
- /** Check if class `subclass` is `superclass` or extends from `superclass`
9
- * @internal
10
- * @param subclass the class that may be a subclass of `superclass`
11
- * @param superclass the class that may be a base class of `subclass`
12
- * @returns whether `subclass` is a subclass of `superclass`
13
- */
14
- export declare function isSubclassOf<SuperClass extends new (..._: any[]) => any, NonSubClass extends new (..._: any[]) => any, SubClass extends new (..._: any[]) => InstanceType<SuperClass>>(subclass: SuperClass | SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass | SuperClass;
1
+ /** Check if class `subclass` is a different class from `superclass` but extends from `superclass`
2
+ * @internal
3
+ * @param subclass the class that may be a subclass of `superclass`
4
+ * @param superclass the class that may be a base class of `subclass`
5
+ * @returns whether `subclass` is a proper subclass of `superclass`
6
+ */
7
+ export declare function isProperSubclassOf<SuperClass extends new (..._: any[]) => any, NonSubClass extends new (..._: any[]) => any, SubClass extends new (..._: any[]) => InstanceType<SuperClass>>(subclass: SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass;
8
+ /** Check if class `subclass` is `superclass` or extends from `superclass`
9
+ * @internal
10
+ * @param subclass the class that may be a subclass of `superclass`
11
+ * @param superclass the class that may be a base class of `subclass`
12
+ * @returns whether `subclass` is a subclass of `superclass`
13
+ */
14
+ export declare function isSubclassOf<SuperClass extends new (..._: any[]) => any, NonSubClass extends new (..._: any[]) => any, SubClass extends new (..._: any[]) => InstanceType<SuperClass>>(subclass: SuperClass | SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass | SuperClass;
15
15
  //# sourceMappingURL=ClassUtils.d.ts.map
@@ -1,28 +1,28 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isSubclassOf = exports.isProperSubclassOf = void 0;
8
- /** Check if class `subclass` is a different class from `superclass` but extends from `superclass`
9
- * @internal
10
- * @param subclass the class that may be a subclass of `superclass`
11
- * @param superclass the class that may be a base class of `subclass`
12
- * @returns whether `subclass` is a proper subclass of `superclass`
13
- */
14
- function isProperSubclassOf(subclass, superclass) {
15
- return subclass.prototype instanceof superclass;
16
- }
17
- exports.isProperSubclassOf = isProperSubclassOf;
18
- /** Check if class `subclass` is `superclass` or extends from `superclass`
19
- * @internal
20
- * @param subclass the class that may be a subclass of `superclass`
21
- * @param superclass the class that may be a base class of `subclass`
22
- * @returns whether `subclass` is a subclass of `superclass`
23
- */
24
- function isSubclassOf(subclass, superclass) {
25
- return subclass === superclass || isProperSubclassOf(subclass, superclass);
26
- }
27
- exports.isSubclassOf = isSubclassOf;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.isSubclassOf = exports.isProperSubclassOf = void 0;
8
+ /** Check if class `subclass` is a different class from `superclass` but extends from `superclass`
9
+ * @internal
10
+ * @param subclass the class that may be a subclass of `superclass`
11
+ * @param superclass the class that may be a base class of `subclass`
12
+ * @returns whether `subclass` is a proper subclass of `superclass`
13
+ */
14
+ function isProperSubclassOf(subclass, superclass) {
15
+ return subclass.prototype instanceof superclass;
16
+ }
17
+ exports.isProperSubclassOf = isProperSubclassOf;
18
+ /** Check if class `subclass` is `superclass` or extends from `superclass`
19
+ * @internal
20
+ * @param subclass the class that may be a subclass of `superclass`
21
+ * @param superclass the class that may be a base class of `subclass`
22
+ * @returns whether `subclass` is a subclass of `superclass`
23
+ */
24
+ function isSubclassOf(subclass, superclass) {
25
+ return subclass === superclass || isProperSubclassOf(subclass, superclass);
26
+ }
27
+ exports.isSubclassOf = isSubclassOf;
28
28
  //# sourceMappingURL=ClassUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClassUtils.js","sourceRoot":"","sources":["../../src/ClassUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;;;;GAKG;AACH,SAAgB,kBAAkB,CAIhC,QAAgC,EAAE,UAAsB;IACxD,OAAO,QAAQ,CAAC,SAAS,YAAY,UAAU,CAAC;AAClD,CAAC;AAND,gDAMC;AAED;;;;;GAKG;AACH,SAAgB,YAAY,CAI1B,QAA6C,EAAE,UAAsB;IACrE,OAAO,QAAQ,KAAK,UAAU,IAAI,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC7E,CAAC;AAND,oCAMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** Check if class `subclass` is a different class from `superclass` but extends from `superclass`\n * @internal\n * @param subclass the class that may be a subclass of `superclass`\n * @param superclass the class that may be a base class of `subclass`\n * @returns whether `subclass` is a proper subclass of `superclass`\n */\nexport function isProperSubclassOf<\n SuperClass extends new (..._: any[]) => any,\n NonSubClass extends new (..._: any[]) => any,\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\n>(subclass: SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass {\n return subclass.prototype instanceof superclass;\n}\n\n/** Check if class `subclass` is `superclass` or extends from `superclass`\n * @internal\n * @param subclass the class that may be a subclass of `superclass`\n * @param superclass the class that may be a base class of `subclass`\n * @returns whether `subclass` is a subclass of `superclass`\n */\nexport function isSubclassOf<\n SuperClass extends new (..._: any[]) => any,\n NonSubClass extends new (..._: any[]) => any,\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\n>(subclass: SuperClass | SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass | SuperClass {\n return subclass === superclass || isProperSubclassOf(subclass, superclass);\n}\n"]}
1
+ {"version":3,"file":"ClassUtils.js","sourceRoot":"","sources":["../../src/ClassUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;;;;GAKG;AACH,SAAgB,kBAAkB,CAIhC,QAAgC,EAAE,UAAsB;IACxD,OAAO,QAAQ,CAAC,SAAS,YAAY,UAAU,CAAC;AAClD,CAAC;AAND,gDAMC;AAED;;;;;GAKG;AACH,SAAgB,YAAY,CAI1B,QAA6C,EAAE,UAAsB;IACrE,OAAO,QAAQ,KAAK,UAAU,IAAI,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC7E,CAAC;AAND,oCAMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** Check if class `subclass` is a different class from `superclass` but extends from `superclass`\r\n * @internal\r\n * @param subclass the class that may be a subclass of `superclass`\r\n * @param superclass the class that may be a base class of `subclass`\r\n * @returns whether `subclass` is a proper subclass of `superclass`\r\n */\r\nexport function isProperSubclassOf<\r\n SuperClass extends new (..._: any[]) => any,\r\n NonSubClass extends new (..._: any[]) => any,\r\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\r\n>(subclass: SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass {\r\n return subclass.prototype instanceof superclass;\r\n}\r\n\r\n/** Check if class `subclass` is `superclass` or extends from `superclass`\r\n * @internal\r\n * @param subclass the class that may be a subclass of `superclass`\r\n * @param superclass the class that may be a base class of `subclass`\r\n * @returns whether `subclass` is a subclass of `superclass`\r\n */\r\nexport function isSubclassOf<\r\n SuperClass extends new (..._: any[]) => any,\r\n NonSubClass extends new (..._: any[]) => any,\r\n SubClass extends new (..._: any[]) => InstanceType<SuperClass>,\r\n>(subclass: SuperClass | SubClass | NonSubClass, superclass: SuperClass): subclass is SubClass | SuperClass {\r\n return subclass === superclass || isProperSubclassOf(subclass, superclass);\r\n}\r\n"]}
@@ -1,48 +1,48 @@
1
- /** @packageDocumentation
2
- * @module Utils
3
- */
4
- /**
5
- * A function that returns a numerical value indicating how two objects are ordered in relation to one another.
6
- * Such functions are used by various collection classes throughout the library.
7
- * Given values `lhs` and `rhs`, the function returns:
8
- * - Zero if lhs == rhs
9
- * - A negative number if lhs < rhs
10
- * - A positive number if lhs > rhs
11
- *
12
- * An OrderedComparator `must` implement [strict weak ordering](https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings), which can be summarized by the following rules:
13
- * - `compare(x, x)` returns zero.
14
- * - If `compare(x, y)` returns zero, then so does `compare(y, x)` (i.e., `x == y` implies `y == x`).
15
- * - If `compare(x, y)` returns non-zero, then `compare(y, x)` returns a value with an opposite sign (i.e., `x < y` implies `y > x`).
16
- * - If `compare(x, y)` and `compare(y, z)` return non-zero values with the same sign, then `compare(x, z)` returns a value with the same sign (i.e., `x < y < z` implies `x < z`).
17
- *
18
- * @see SortedArray
19
- * @see Dictionary
20
- * @see IndexMap
21
- * @see PriorityQueue
22
- * @public
23
- */
24
- export declare type OrderedComparator<T, U = T> = (lhs: T, rhs: U) => number;
25
- /**
26
- * An [[OrderedComparator]] for numbers that treats two numbers as equal if the absolute value of their difference is less than a specified tolerance.
27
- * @public
28
- */
29
- export declare function compareWithTolerance(a: number, b: number, tolerance?: number): number;
30
- /** @public */
31
- export declare function compareNumbers(a: number, b: number): number;
32
- /** @public */
33
- export declare function compareBooleans(a: boolean, b: boolean): number;
34
- /** @public */
35
- export declare function compareStrings(a: string, b: string): number;
36
- /** @public */
37
- export declare function comparePossiblyUndefined<T>(compareDefined: (lhs: T, rhs: T) => number, lhs?: T, rhs?: T): number;
38
- /** @public */
39
- export declare function compareStringsOrUndefined(lhs?: string, rhs?: string): number;
40
- /** @public */
41
- export declare function compareNumbersOrUndefined(lhs?: number, rhs?: number): number;
42
- /** @public */
43
- export declare function compareBooleansOrUndefined(lhs?: boolean, rhs?: boolean): number;
44
- /** Compare two possibly-undefined values for equality. If both are undefined, the comparison is performed by the supplied `areEqual` function.
45
- * @public
46
- */
47
- export declare function areEqualPossiblyUndefined<T, U>(t: T | undefined, u: U | undefined, areEqual: (t: T, u: U) => boolean): boolean;
1
+ /** @packageDocumentation
2
+ * @module Utils
3
+ */
4
+ /**
5
+ * A function that returns a numerical value indicating how two objects are ordered in relation to one another.
6
+ * Such functions are used by various collection classes throughout the library.
7
+ * Given values `lhs` and `rhs`, the function returns:
8
+ * - Zero if lhs == rhs
9
+ * - A negative number if lhs < rhs
10
+ * - A positive number if lhs > rhs
11
+ *
12
+ * An OrderedComparator `must` implement [strict weak ordering](https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings), which can be summarized by the following rules:
13
+ * - `compare(x, x)` returns zero.
14
+ * - If `compare(x, y)` returns zero, then so does `compare(y, x)` (i.e., `x == y` implies `y == x`).
15
+ * - If `compare(x, y)` returns non-zero, then `compare(y, x)` returns a value with an opposite sign (i.e., `x < y` implies `y > x`).
16
+ * - If `compare(x, y)` and `compare(y, z)` return non-zero values with the same sign, then `compare(x, z)` returns a value with the same sign (i.e., `x < y < z` implies `x < z`).
17
+ *
18
+ * @see SortedArray
19
+ * @see Dictionary
20
+ * @see IndexMap
21
+ * @see PriorityQueue
22
+ * @public
23
+ */
24
+ export declare type OrderedComparator<T, U = T> = (lhs: T, rhs: U) => number;
25
+ /**
26
+ * An [[OrderedComparator]] for numbers that treats two numbers as equal if the absolute value of their difference is less than a specified tolerance.
27
+ * @public
28
+ */
29
+ export declare function compareWithTolerance(a: number, b: number, tolerance?: number): number;
30
+ /** @public */
31
+ export declare function compareNumbers(a: number, b: number): number;
32
+ /** @public */
33
+ export declare function compareBooleans(a: boolean, b: boolean): number;
34
+ /** @public */
35
+ export declare function compareStrings(a: string, b: string): number;
36
+ /** @public */
37
+ export declare function comparePossiblyUndefined<T>(compareDefined: (lhs: T, rhs: T) => number, lhs?: T, rhs?: T): number;
38
+ /** @public */
39
+ export declare function compareStringsOrUndefined(lhs?: string, rhs?: string): number;
40
+ /** @public */
41
+ export declare function compareNumbersOrUndefined(lhs?: number, rhs?: number): number;
42
+ /** @public */
43
+ export declare function compareBooleansOrUndefined(lhs?: boolean, rhs?: boolean): number;
44
+ /** Compare two possibly-undefined values for equality. If both are undefined, the comparison is performed by the supplied `areEqual` function.
45
+ * @public
46
+ */
47
+ export declare function areEqualPossiblyUndefined<T, U>(t: T | undefined, u: U | undefined, areEqual: (t: T, u: U) => boolean): boolean;
48
48
  //# sourceMappingURL=Compare.d.ts.map
@@ -1,76 +1,76 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Utils
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.areEqualPossiblyUndefined = exports.compareBooleansOrUndefined = exports.compareNumbersOrUndefined = exports.compareStringsOrUndefined = exports.comparePossiblyUndefined = exports.compareStrings = exports.compareBooleans = exports.compareNumbers = exports.compareWithTolerance = void 0;
11
- /**
12
- * An [[OrderedComparator]] for numbers that treats two numbers as equal if the absolute value of their difference is less than a specified tolerance.
13
- * @public
14
- */
15
- function compareWithTolerance(a, b, tolerance = 0.1) {
16
- if (a < b - tolerance)
17
- return -1;
18
- else if (a > b + tolerance)
19
- return 1;
20
- else
21
- return 0;
22
- }
23
- exports.compareWithTolerance = compareWithTolerance;
24
- /** @public */
25
- function compareNumbers(a, b) {
26
- return a - b;
27
- }
28
- exports.compareNumbers = compareNumbers;
29
- /** @public */
30
- function compareBooleans(a, b) {
31
- return a !== b ? (a < b ? -1 : 1) : 0;
32
- }
33
- exports.compareBooleans = compareBooleans;
34
- /** @public */
35
- function compareStrings(a, b) {
36
- return a === b ? 0 : (a < b ? -1 : 1);
37
- }
38
- exports.compareStrings = compareStrings;
39
- /** @public */
40
- function comparePossiblyUndefined(compareDefined, lhs, rhs) {
41
- if (undefined === lhs)
42
- return undefined === rhs ? 0 : -1;
43
- else if (undefined === rhs)
44
- return 1;
45
- else
46
- return compareDefined(lhs, rhs);
47
- }
48
- exports.comparePossiblyUndefined = comparePossiblyUndefined;
49
- /** @public */
50
- function compareStringsOrUndefined(lhs, rhs) {
51
- return comparePossiblyUndefined(compareStrings, lhs, rhs);
52
- }
53
- exports.compareStringsOrUndefined = compareStringsOrUndefined;
54
- /** @public */
55
- function compareNumbersOrUndefined(lhs, rhs) {
56
- return comparePossiblyUndefined(compareNumbers, lhs, rhs);
57
- }
58
- exports.compareNumbersOrUndefined = compareNumbersOrUndefined;
59
- /** @public */
60
- function compareBooleansOrUndefined(lhs, rhs) {
61
- return comparePossiblyUndefined(compareBooleans, lhs, rhs);
62
- }
63
- exports.compareBooleansOrUndefined = compareBooleansOrUndefined;
64
- /** Compare two possibly-undefined values for equality. If both are undefined, the comparison is performed by the supplied `areEqual` function.
65
- * @public
66
- */
67
- function areEqualPossiblyUndefined(t, u, areEqual) {
68
- if (undefined === t)
69
- return undefined === u;
70
- else if (undefined === u)
71
- return false;
72
- else
73
- return areEqual(t, u);
74
- }
75
- exports.areEqualPossiblyUndefined = areEqualPossiblyUndefined;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Utils
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.areEqualPossiblyUndefined = exports.compareBooleansOrUndefined = exports.compareNumbersOrUndefined = exports.compareStringsOrUndefined = exports.comparePossiblyUndefined = exports.compareStrings = exports.compareBooleans = exports.compareNumbers = exports.compareWithTolerance = void 0;
11
+ /**
12
+ * An [[OrderedComparator]] for numbers that treats two numbers as equal if the absolute value of their difference is less than a specified tolerance.
13
+ * @public
14
+ */
15
+ function compareWithTolerance(a, b, tolerance = 0.1) {
16
+ if (a < b - tolerance)
17
+ return -1;
18
+ else if (a > b + tolerance)
19
+ return 1;
20
+ else
21
+ return 0;
22
+ }
23
+ exports.compareWithTolerance = compareWithTolerance;
24
+ /** @public */
25
+ function compareNumbers(a, b) {
26
+ return a - b;
27
+ }
28
+ exports.compareNumbers = compareNumbers;
29
+ /** @public */
30
+ function compareBooleans(a, b) {
31
+ return a !== b ? (a < b ? -1 : 1) : 0;
32
+ }
33
+ exports.compareBooleans = compareBooleans;
34
+ /** @public */
35
+ function compareStrings(a, b) {
36
+ return a === b ? 0 : (a < b ? -1 : 1);
37
+ }
38
+ exports.compareStrings = compareStrings;
39
+ /** @public */
40
+ function comparePossiblyUndefined(compareDefined, lhs, rhs) {
41
+ if (undefined === lhs)
42
+ return undefined === rhs ? 0 : -1;
43
+ else if (undefined === rhs)
44
+ return 1;
45
+ else
46
+ return compareDefined(lhs, rhs);
47
+ }
48
+ exports.comparePossiblyUndefined = comparePossiblyUndefined;
49
+ /** @public */
50
+ function compareStringsOrUndefined(lhs, rhs) {
51
+ return comparePossiblyUndefined(compareStrings, lhs, rhs);
52
+ }
53
+ exports.compareStringsOrUndefined = compareStringsOrUndefined;
54
+ /** @public */
55
+ function compareNumbersOrUndefined(lhs, rhs) {
56
+ return comparePossiblyUndefined(compareNumbers, lhs, rhs);
57
+ }
58
+ exports.compareNumbersOrUndefined = compareNumbersOrUndefined;
59
+ /** @public */
60
+ function compareBooleansOrUndefined(lhs, rhs) {
61
+ return comparePossiblyUndefined(compareBooleans, lhs, rhs);
62
+ }
63
+ exports.compareBooleansOrUndefined = compareBooleansOrUndefined;
64
+ /** Compare two possibly-undefined values for equality. If both are undefined, the comparison is performed by the supplied `areEqual` function.
65
+ * @public
66
+ */
67
+ function areEqualPossiblyUndefined(t, u, areEqual) {
68
+ if (undefined === t)
69
+ return undefined === u;
70
+ else if (undefined === u)
71
+ return false;
72
+ else
73
+ return areEqual(t, u);
74
+ }
75
+ exports.areEqualPossiblyUndefined = areEqualPossiblyUndefined;
76
76
  //# sourceMappingURL=Compare.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Compare.js","sourceRoot":"","sources":["../../src/Compare.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAwBH;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,CAAS,EAAE,CAAS,EAAE,SAAS,GAAG,GAAG;IACxE,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS;QACnB,OAAO,CAAC,CAAC,CAAC;SACP,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS;QACxB,OAAO,CAAC,CAAC;;QAET,OAAO,CAAC,CAAC;AACb,CAAC;AAPD,oDAOC;AAED,cAAc;AACd,SAAgB,cAAc,CAAC,CAAS,EAAE,CAAS;IACjD,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAFD,wCAEC;AAED,cAAc;AACd,SAAgB,eAAe,CAAC,CAAU,EAAE,CAAU;IACpD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC;AAFD,0CAEC;AAED,cAAc;AACd,SAAgB,cAAc,CAAC,CAAS,EAAE,CAAS;IACjD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC;AAFD,wCAEC;AAED,cAAc;AACd,SAAgB,wBAAwB,CAAI,cAA0C,EAAE,GAAO,EAAE,GAAO;IACtG,IAAI,SAAS,KAAK,GAAG;QACnB,OAAO,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/B,IAAI,SAAS,KAAK,GAAG;QACxB,OAAO,CAAC,CAAC;;QAET,OAAO,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAPD,4DAOC;AAED,cAAc;AACd,SAAgB,yBAAyB,CAAC,GAAY,EAAE,GAAY;IAClE,OAAO,wBAAwB,CAAC,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5D,CAAC;AAFD,8DAEC;AAED,cAAc;AACd,SAAgB,yBAAyB,CAAC,GAAY,EAAE,GAAY;IAClE,OAAO,wBAAwB,CAAC,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5D,CAAC;AAFD,8DAEC;AAED,cAAc;AACd,SAAgB,0BAA0B,CAAC,GAAa,EAAE,GAAa;IACrE,OAAO,wBAAwB,CAAC,eAAe,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC7D,CAAC;AAFD,gEAEC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAO,CAAgB,EAAE,CAAgB,EAAE,QAAiC;IACnH,IAAI,SAAS,KAAK,CAAC;QACjB,OAAO,SAAS,KAAK,CAAC,CAAC;SACpB,IAAI,SAAS,KAAK,CAAC;QACtB,OAAO,KAAK,CAAC;;QAEb,OAAO,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC;AAPD,8DAOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\n/**\n * A function that returns a numerical value indicating how two objects are ordered in relation to one another.\n * Such functions are used by various collection classes throughout the library.\n * Given values `lhs` and `rhs`, the function returns:\n * - Zero if lhs == rhs\n * - A negative number if lhs < rhs\n * - A positive number if lhs > rhs\n *\n * An OrderedComparator `must` implement [strict weak ordering](https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings), which can be summarized by the following rules:\n * - `compare(x, x)` returns zero.\n * - If `compare(x, y)` returns zero, then so does `compare(y, x)` (i.e., `x == y` implies `y == x`).\n * - If `compare(x, y)` returns non-zero, then `compare(y, x)` returns a value with an opposite sign (i.e., `x < y` implies `y > x`).\n * - If `compare(x, y)` and `compare(y, z)` return non-zero values with the same sign, then `compare(x, z)` returns a value with the same sign (i.e., `x < y < z` implies `x < z`).\n *\n * @see SortedArray\n * @see Dictionary\n * @see IndexMap\n * @see PriorityQueue\n * @public\n */\nexport type OrderedComparator<T, U = T> = (lhs: T, rhs: U) => number;\n\n/**\n * An [[OrderedComparator]] for numbers that treats two numbers as equal if the absolute value of their difference is less than a specified tolerance.\n * @public\n */\nexport function compareWithTolerance(a: number, b: number, tolerance = 0.1): number {\n if (a < b - tolerance)\n return -1;\n else if (a > b + tolerance)\n return 1;\n else\n return 0;\n}\n\n/** @public */\nexport function compareNumbers(a: number, b: number): number {\n return a - b;\n}\n\n/** @public */\nexport function compareBooleans(a: boolean, b: boolean): number {\n return a !== b ? (a < b ? -1 : 1) : 0;\n}\n\n/** @public */\nexport function compareStrings(a: string, b: string): number {\n return a === b ? 0 : (a < b ? -1 : 1);\n}\n\n/** @public */\nexport function comparePossiblyUndefined<T>(compareDefined: (lhs: T, rhs: T) => number, lhs?: T, rhs?: T): number {\n if (undefined === lhs)\n return undefined === rhs ? 0 : -1;\n else if (undefined === rhs)\n return 1;\n else\n return compareDefined(lhs, rhs);\n}\n\n/** @public */\nexport function compareStringsOrUndefined(lhs?: string, rhs?: string): number {\n return comparePossiblyUndefined(compareStrings, lhs, rhs);\n}\n\n/** @public */\nexport function compareNumbersOrUndefined(lhs?: number, rhs?: number): number {\n return comparePossiblyUndefined(compareNumbers, lhs, rhs);\n}\n\n/** @public */\nexport function compareBooleansOrUndefined(lhs?: boolean, rhs?: boolean): number {\n return comparePossiblyUndefined(compareBooleans, lhs, rhs);\n}\n\n/** Compare two possibly-undefined values for equality. If both are undefined, the comparison is performed by the supplied `areEqual` function.\n * @public\n */\nexport function areEqualPossiblyUndefined<T, U>(t: T | undefined, u: U | undefined, areEqual: (t: T, u: U) => boolean): boolean {\n if (undefined === t)\n return undefined === u;\n else if (undefined === u)\n return false;\n else\n return areEqual(t, u);\n}\n"]}
1
+ {"version":3,"file":"Compare.js","sourceRoot":"","sources":["../../src/Compare.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAwBH;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,CAAS,EAAE,CAAS,EAAE,SAAS,GAAG,GAAG;IACxE,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS;QACnB,OAAO,CAAC,CAAC,CAAC;SACP,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS;QACxB,OAAO,CAAC,CAAC;;QAET,OAAO,CAAC,CAAC;AACb,CAAC;AAPD,oDAOC;AAED,cAAc;AACd,SAAgB,cAAc,CAAC,CAAS,EAAE,CAAS;IACjD,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAFD,wCAEC;AAED,cAAc;AACd,SAAgB,eAAe,CAAC,CAAU,EAAE,CAAU;IACpD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC;AAFD,0CAEC;AAED,cAAc;AACd,SAAgB,cAAc,CAAC,CAAS,EAAE,CAAS;IACjD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC;AAFD,wCAEC;AAED,cAAc;AACd,SAAgB,wBAAwB,CAAI,cAA0C,EAAE,GAAO,EAAE,GAAO;IACtG,IAAI,SAAS,KAAK,GAAG;QACnB,OAAO,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/B,IAAI,SAAS,KAAK,GAAG;QACxB,OAAO,CAAC,CAAC;;QAET,OAAO,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAPD,4DAOC;AAED,cAAc;AACd,SAAgB,yBAAyB,CAAC,GAAY,EAAE,GAAY;IAClE,OAAO,wBAAwB,CAAC,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5D,CAAC;AAFD,8DAEC;AAED,cAAc;AACd,SAAgB,yBAAyB,CAAC,GAAY,EAAE,GAAY;IAClE,OAAO,wBAAwB,CAAC,cAAc,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5D,CAAC;AAFD,8DAEC;AAED,cAAc;AACd,SAAgB,0BAA0B,CAAC,GAAa,EAAE,GAAa;IACrE,OAAO,wBAAwB,CAAC,eAAe,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC7D,CAAC;AAFD,gEAEC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAO,CAAgB,EAAE,CAAgB,EAAE,QAAiC;IACnH,IAAI,SAAS,KAAK,CAAC;QACjB,OAAO,SAAS,KAAK,CAAC,CAAC;SACpB,IAAI,SAAS,KAAK,CAAC;QACtB,OAAO,KAAK,CAAC;;QAEb,OAAO,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC;AAPD,8DAOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/**\r\n * A function that returns a numerical value indicating how two objects are ordered in relation to one another.\r\n * Such functions are used by various collection classes throughout the library.\r\n * Given values `lhs` and `rhs`, the function returns:\r\n * - Zero if lhs == rhs\r\n * - A negative number if lhs < rhs\r\n * - A positive number if lhs > rhs\r\n *\r\n * An OrderedComparator `must` implement [strict weak ordering](https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings), which can be summarized by the following rules:\r\n * - `compare(x, x)` returns zero.\r\n * - If `compare(x, y)` returns zero, then so does `compare(y, x)` (i.e., `x == y` implies `y == x`).\r\n * - If `compare(x, y)` returns non-zero, then `compare(y, x)` returns a value with an opposite sign (i.e., `x < y` implies `y > x`).\r\n * - If `compare(x, y)` and `compare(y, z)` return non-zero values with the same sign, then `compare(x, z)` returns a value with the same sign (i.e., `x < y < z` implies `x < z`).\r\n *\r\n * @see SortedArray\r\n * @see Dictionary\r\n * @see IndexMap\r\n * @see PriorityQueue\r\n * @public\r\n */\r\nexport type OrderedComparator<T, U = T> = (lhs: T, rhs: U) => number;\r\n\r\n/**\r\n * An [[OrderedComparator]] for numbers that treats two numbers as equal if the absolute value of their difference is less than a specified tolerance.\r\n * @public\r\n */\r\nexport function compareWithTolerance(a: number, b: number, tolerance = 0.1): number {\r\n if (a < b - tolerance)\r\n return -1;\r\n else if (a > b + tolerance)\r\n return 1;\r\n else\r\n return 0;\r\n}\r\n\r\n/** @public */\r\nexport function compareNumbers(a: number, b: number): number {\r\n return a - b;\r\n}\r\n\r\n/** @public */\r\nexport function compareBooleans(a: boolean, b: boolean): number {\r\n return a !== b ? (a < b ? -1 : 1) : 0;\r\n}\r\n\r\n/** @public */\r\nexport function compareStrings(a: string, b: string): number {\r\n return a === b ? 0 : (a < b ? -1 : 1);\r\n}\r\n\r\n/** @public */\r\nexport function comparePossiblyUndefined<T>(compareDefined: (lhs: T, rhs: T) => number, lhs?: T, rhs?: T): number {\r\n if (undefined === lhs)\r\n return undefined === rhs ? 0 : -1;\r\n else if (undefined === rhs)\r\n return 1;\r\n else\r\n return compareDefined(lhs, rhs);\r\n}\r\n\r\n/** @public */\r\nexport function compareStringsOrUndefined(lhs?: string, rhs?: string): number {\r\n return comparePossiblyUndefined(compareStrings, lhs, rhs);\r\n}\r\n\r\n/** @public */\r\nexport function compareNumbersOrUndefined(lhs?: number, rhs?: number): number {\r\n return comparePossiblyUndefined(compareNumbers, lhs, rhs);\r\n}\r\n\r\n/** @public */\r\nexport function compareBooleansOrUndefined(lhs?: boolean, rhs?: boolean): number {\r\n return comparePossiblyUndefined(compareBooleans, lhs, rhs);\r\n}\r\n\r\n/** Compare two possibly-undefined values for equality. If both are undefined, the comparison is performed by the supplied `areEqual` function.\r\n * @public\r\n */\r\nexport function areEqualPossiblyUndefined<T, U>(t: T | undefined, u: U | undefined, areEqual: (t: T, u: U) => boolean): boolean {\r\n if (undefined === t)\r\n return undefined === u;\r\n else if (undefined === u)\r\n return false;\r\n else\r\n return areEqual(t, u);\r\n}\r\n"]}