@nascentdigital/funnel-core 4.4.4

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 (368) hide show
  1. package/dist/app/AppConfig.d.ts +41 -0
  2. package/dist/app/AppConfig.js +93 -0
  3. package/dist/app/BrandConfig.d.ts +13 -0
  4. package/dist/app/BrandConfig.js +2 -0
  5. package/dist/app/FeaturesConfig.d.ts +6 -0
  6. package/dist/app/FeaturesConfig.js +2 -0
  7. package/dist/app/RegionsConfig.d.ts +43 -0
  8. package/dist/app/RegionsConfig.js +113 -0
  9. package/dist/app/UIConfig.d.ts +4 -0
  10. package/dist/app/UIConfig.js +2 -0
  11. package/dist/app/index.d.ts +5 -0
  12. package/dist/app/index.js +21 -0
  13. package/dist/consent/ConsentCategory.d.ts +12 -0
  14. package/dist/consent/ConsentCategory.js +28 -0
  15. package/dist/consent/ConsentService.d.ts +15 -0
  16. package/dist/consent/ConsentService.js +37 -0
  17. package/dist/consent/index.d.ts +2 -0
  18. package/dist/consent/index.js +18 -0
  19. package/dist/errors/IsometricError.d.ts +19 -0
  20. package/dist/errors/IsometricError.js +30 -0
  21. package/dist/errors/IsometricErrorModule.d.ts +11 -0
  22. package/dist/errors/IsometricErrorModule.js +2 -0
  23. package/dist/errors/IsometricErrorUtils.d.ts +9 -0
  24. package/dist/errors/IsometricErrorUtils.js +85 -0
  25. package/dist/errors/SerializedIsometricError.d.ts +10 -0
  26. package/dist/errors/SerializedIsometricError.js +15 -0
  27. package/dist/errors/api/ApiError.d.ts +15 -0
  28. package/dist/errors/api/ApiError.js +23 -0
  29. package/dist/errors/api/ApiErrors.d.ts +7 -0
  30. package/dist/errors/api/ApiErrors.js +67 -0
  31. package/dist/errors/api/ArgumentError.d.ts +7 -0
  32. package/dist/errors/api/ArgumentError.js +18 -0
  33. package/dist/errors/api/ConcurrencyError.d.ts +4 -0
  34. package/dist/errors/api/ConcurrencyError.js +11 -0
  35. package/dist/errors/api/ConflictError.d.ts +4 -0
  36. package/dist/errors/api/ConflictError.js +11 -0
  37. package/dist/errors/api/DependencyError.d.ts +4 -0
  38. package/dist/errors/api/DependencyError.js +11 -0
  39. package/dist/errors/api/IllegalStateError.d.ts +4 -0
  40. package/dist/errors/api/IllegalStateError.js +11 -0
  41. package/dist/errors/api/InvalidOperationError.d.ts +4 -0
  42. package/dist/errors/api/InvalidOperationError.js +11 -0
  43. package/dist/errors/api/NotAuthenticatedError.d.ts +4 -0
  44. package/dist/errors/api/NotAuthenticatedError.js +11 -0
  45. package/dist/errors/api/NotAuthorizedError.d.ts +4 -0
  46. package/dist/errors/api/NotAuthorizedError.js +11 -0
  47. package/dist/errors/api/NotAvailableError.d.ts +4 -0
  48. package/dist/errors/api/NotAvailableError.js +11 -0
  49. package/dist/errors/api/NotFoundError.d.ts +4 -0
  50. package/dist/errors/api/NotFoundError.js +11 -0
  51. package/dist/errors/api/NotImplementedError.d.ts +4 -0
  52. package/dist/errors/api/NotImplementedError.js +11 -0
  53. package/dist/errors/api/OfflineError.d.ts +4 -0
  54. package/dist/errors/api/OfflineError.js +11 -0
  55. package/dist/errors/api/RangeError.d.ts +4 -0
  56. package/dist/errors/api/RangeError.js +11 -0
  57. package/dist/errors/api/ServerError.d.ts +4 -0
  58. package/dist/errors/api/ServerError.js +11 -0
  59. package/dist/errors/api/TimeoutError.d.ts +4 -0
  60. package/dist/errors/api/TimeoutError.js +11 -0
  61. package/dist/errors/api/index.d.ts +16 -0
  62. package/dist/errors/api/index.js +32 -0
  63. package/dist/errors/index.d.ts +5 -0
  64. package/dist/errors/index.js +26 -0
  65. package/dist/forms/FormModel.d.ts +47 -0
  66. package/dist/forms/FormModel.js +149 -0
  67. package/dist/forms/Forms.d.ts +15 -0
  68. package/dist/forms/Forms.js +35 -0
  69. package/dist/forms/IFormService.d.ts +6 -0
  70. package/dist/forms/IFormService.js +2 -0
  71. package/dist/forms/TranslateSchema.d.ts +8 -0
  72. package/dist/forms/TranslateSchema.js +2 -0
  73. package/dist/forms/index.d.ts +4 -0
  74. package/dist/forms/index.js +20 -0
  75. package/dist/index.d.ts +10 -0
  76. package/dist/index.js +49 -0
  77. package/dist/regionalization/Country.d.ts +266 -0
  78. package/dist/regionalization/Country.js +338 -0
  79. package/dist/regionalization/Language.d.ts +199 -0
  80. package/dist/regionalization/Language.js +237 -0
  81. package/dist/regionalization/Locale.d.ts +28 -0
  82. package/dist/regionalization/Locale.js +49 -0
  83. package/dist/regionalization/Localized.d.ts +10 -0
  84. package/dist/regionalization/Localized.js +36 -0
  85. package/dist/regionalization/LocalizedCopy.d.ts +9 -0
  86. package/dist/regionalization/LocalizedCopy.js +26 -0
  87. package/dist/regionalization/Regionalization.d.ts +50 -0
  88. package/dist/regionalization/Regionalization.js +260 -0
  89. package/dist/regionalization/Regions.d.ts +2 -0
  90. package/dist/regionalization/Regions.js +2 -0
  91. package/dist/regionalization/index.d.ts +7 -0
  92. package/dist/regionalization/index.js +23 -0
  93. package/dist/schema/Asset.d.ts +23 -0
  94. package/dist/schema/Asset.js +36 -0
  95. package/dist/schema/AssetScope.d.ts +75 -0
  96. package/dist/schema/AssetScope.js +146 -0
  97. package/dist/schema/Block.d.ts +105 -0
  98. package/dist/schema/Block.js +122 -0
  99. package/dist/schema/ChangeSet.d.ts +108 -0
  100. package/dist/schema/ChangeSet.js +187 -0
  101. package/dist/schema/Collection.d.ts +197 -0
  102. package/dist/schema/Collection.js +165 -0
  103. package/dist/schema/CollectionModel.d.ts +30 -0
  104. package/dist/schema/CollectionModel.js +383 -0
  105. package/dist/schema/CollectionSnapshot.d.ts +11 -0
  106. package/dist/schema/CollectionSnapshot.js +12 -0
  107. package/dist/schema/Fields.d.ts +31 -0
  108. package/dist/schema/Fields.js +21 -0
  109. package/dist/schema/Form.d.ts +31 -0
  110. package/dist/schema/Form.js +23 -0
  111. package/dist/schema/LinkedCollectionModel.d.ts +9 -0
  112. package/dist/schema/LinkedCollectionModel.js +19 -0
  113. package/dist/schema/LinkedData.d.ts +44 -0
  114. package/dist/schema/LinkedData.js +288 -0
  115. package/dist/schema/LinkedPageModel.d.ts +11 -0
  116. package/dist/schema/LinkedPageModel.js +26 -0
  117. package/dist/schema/Optional.d.ts +23 -0
  118. package/dist/schema/Optional.js +34 -0
  119. package/dist/schema/Page.d.ts +299 -0
  120. package/dist/schema/Page.js +244 -0
  121. package/dist/schema/PageModel.d.ts +58 -0
  122. package/dist/schema/PageModel.js +881 -0
  123. package/dist/schema/PageQuery.d.ts +60 -0
  124. package/dist/schema/PageQuery.js +116 -0
  125. package/dist/schema/PageRoute.d.ts +7 -0
  126. package/dist/schema/PageRoute.js +48 -0
  127. package/dist/schema/PageSnapshot.d.ts +11 -0
  128. package/dist/schema/PageSnapshot.js +12 -0
  129. package/dist/schema/Section.d.ts +71 -0
  130. package/dist/schema/Section.js +35 -0
  131. package/dist/schema/Seo.d.ts +13 -0
  132. package/dist/schema/Seo.js +25 -0
  133. package/dist/schema/Site.d.ts +40 -0
  134. package/dist/schema/Site.js +87 -0
  135. package/dist/schema/SiteModel.d.ts +5 -0
  136. package/dist/schema/SiteModel.js +10 -0
  137. package/dist/schema/Tag.d.ts +28 -0
  138. package/dist/schema/Tag.js +59 -0
  139. package/dist/schema/TagGroup.d.ts +26 -0
  140. package/dist/schema/TagGroup.js +64 -0
  141. package/dist/schema/field/Field.d.ts +179 -0
  142. package/dist/schema/field/Field.js +309 -0
  143. package/dist/schema/field/base/AssetField.d.ts +148 -0
  144. package/dist/schema/field/base/AssetField.js +206 -0
  145. package/dist/schema/field/base/BooleanField.d.ts +21 -0
  146. package/dist/schema/field/base/BooleanField.js +38 -0
  147. package/dist/schema/field/base/CollectionField.d.ts +34 -0
  148. package/dist/schema/field/base/CollectionField.js +85 -0
  149. package/dist/schema/field/base/DateField.d.ts +21 -0
  150. package/dist/schema/field/base/DateField.js +37 -0
  151. package/dist/schema/field/base/DynamicPagesField.d.ts +36 -0
  152. package/dist/schema/field/base/DynamicPagesField.js +50 -0
  153. package/dist/schema/field/base/EmbeddedVideoField.d.ts +45 -0
  154. package/dist/schema/field/base/EmbeddedVideoField.js +176 -0
  155. package/dist/schema/field/base/EnumField.d.ts +40 -0
  156. package/dist/schema/field/base/EnumField.js +131 -0
  157. package/dist/schema/field/base/FormField.d.ts +25 -0
  158. package/dist/schema/field/base/FormField.js +48 -0
  159. package/dist/schema/field/base/LinkField.d.ts +103 -0
  160. package/dist/schema/field/base/LinkField.js +201 -0
  161. package/dist/schema/field/base/PageField.d.ts +46 -0
  162. package/dist/schema/field/base/PageField.js +83 -0
  163. package/dist/schema/field/base/RichTextField.d.ts +71 -0
  164. package/dist/schema/field/base/RichTextField.js +196 -0
  165. package/dist/schema/field/base/TextField.d.ts +33 -0
  166. package/dist/schema/field/base/TextField.js +86 -0
  167. package/dist/schema/field/base/TimestampField.d.ts +25 -0
  168. package/dist/schema/field/base/TimestampField.js +41 -0
  169. package/dist/schema/field/base/index.d.ts +13 -0
  170. package/dist/schema/field/base/index.js +29 -0
  171. package/dist/schema/field/composite/ListField.d.ts +47 -0
  172. package/dist/schema/field/composite/ListField.js +107 -0
  173. package/dist/schema/field/composite/ObjectField.d.ts +56 -0
  174. package/dist/schema/field/composite/ObjectField.js +19 -0
  175. package/dist/schema/field/composite/index.d.ts +2 -0
  176. package/dist/schema/field/composite/index.js +18 -0
  177. package/dist/schema/field/index.d.ts +3 -0
  178. package/dist/schema/field/index.js +19 -0
  179. package/dist/schema/index.d.ts +25 -0
  180. package/dist/schema/index.js +41 -0
  181. package/dist/services/EventBus.d.ts +17 -0
  182. package/dist/services/EventBus.js +37 -0
  183. package/dist/services/humanVerification/IHumanVerification.d.ts +8 -0
  184. package/dist/services/humanVerification/IHumanVerification.js +2 -0
  185. package/dist/services/humanVerification/index.d.ts +1 -0
  186. package/dist/services/humanVerification/index.js +17 -0
  187. package/dist/services/index.d.ts +3 -0
  188. package/dist/services/index.js +19 -0
  189. package/dist/services/leadGen/Contact.d.ts +40 -0
  190. package/dist/services/leadGen/Contact.js +38 -0
  191. package/dist/services/leadGen/ILeadGen.d.ts +16 -0
  192. package/dist/services/leadGen/ILeadGen.js +2 -0
  193. package/dist/services/leadGen/index.d.ts +2 -0
  194. package/dist/services/leadGen/index.js +18 -0
  195. package/dist/types/BoxedValue.d.ts +3 -0
  196. package/dist/types/BoxedValue.js +2 -0
  197. package/dist/types/Callback.d.ts +9 -0
  198. package/dist/types/Callback.js +2 -0
  199. package/dist/types/DateString.d.ts +35 -0
  200. package/dist/types/DateString.js +172 -0
  201. package/dist/types/FilterConditionally.d.ts +3 -0
  202. package/dist/types/FilterConditionally.js +2 -0
  203. package/dist/types/MaybeConditionalValue.d.ts +8 -0
  204. package/dist/types/MaybeConditionalValue.js +12 -0
  205. package/dist/types/Ordinal.d.ts +17 -0
  206. package/dist/types/Ordinal.js +38 -0
  207. package/dist/types/OverridableStringUnion.d.ts +2 -0
  208. package/dist/types/OverridableStringUnion.js +2 -0
  209. package/dist/types/PartialBy.d.ts +1 -0
  210. package/dist/types/PartialBy.js +2 -0
  211. package/dist/types/PickData.d.ts +6 -0
  212. package/dist/types/PickData.js +2 -0
  213. package/dist/types/Provider.d.ts +4 -0
  214. package/dist/types/Provider.js +2 -0
  215. package/dist/types/RequiredBy.d.ts +1 -0
  216. package/dist/types/RequiredBy.js +2 -0
  217. package/dist/types/Result.d.ts +16 -0
  218. package/dist/types/Result.js +2 -0
  219. package/dist/types/Timestamp.d.ts +17 -0
  220. package/dist/types/Timestamp.js +57 -0
  221. package/dist/types/Transform.d.ts +4 -0
  222. package/dist/types/Transform.js +2 -0
  223. package/dist/types/index.d.ts +14 -0
  224. package/dist/types/index.js +30 -0
  225. package/dist/ui/Accessible.d.ts +5 -0
  226. package/dist/ui/Accessible.js +15 -0
  227. package/dist/ui/BlockThemes.d.ts +19 -0
  228. package/dist/ui/BlockThemes.js +29 -0
  229. package/dist/ui/ColorMode.d.ts +12 -0
  230. package/dist/ui/ColorMode.js +49 -0
  231. package/dist/ui/File.d.ts +43 -0
  232. package/dist/ui/File.js +55 -0
  233. package/dist/ui/FileType.d.ts +8 -0
  234. package/dist/ui/FileType.js +48 -0
  235. package/dist/ui/ImageSource.d.ts +12 -0
  236. package/dist/ui/ImageSource.js +48 -0
  237. package/dist/ui/MimeType.d.ts +28 -0
  238. package/dist/ui/MimeType.js +110 -0
  239. package/dist/ui/Placement.d.ts +21 -0
  240. package/dist/ui/Placement.js +135 -0
  241. package/dist/ui/Position.d.ts +6 -0
  242. package/dist/ui/Position.js +42 -0
  243. package/dist/ui/Selector.d.ts +6 -0
  244. package/dist/ui/Selector.js +23 -0
  245. package/dist/ui/SemanticColor.d.ts +8 -0
  246. package/dist/ui/SemanticColor.js +237 -0
  247. package/dist/ui/Visual.d.ts +24 -0
  248. package/dist/ui/Visual.js +66 -0
  249. package/dist/ui/block-layout/BlockLayout.d.ts +99 -0
  250. package/dist/ui/block-layout/BlockLayout.js +286 -0
  251. package/dist/ui/block-layout/index.d.ts +1 -0
  252. package/dist/ui/block-layout/index.js +17 -0
  253. package/dist/ui/browser/BlurHasher.d.ts +13 -0
  254. package/dist/ui/browser/BlurHasher.js +76 -0
  255. package/dist/ui/browser/Browser.d.ts +107 -0
  256. package/dist/ui/browser/Browser.js +313 -0
  257. package/dist/ui/browser/ImageProxy.d.ts +30 -0
  258. package/dist/ui/browser/ImageProxy.js +132 -0
  259. package/dist/ui/browser/InputEvent.d.ts +13 -0
  260. package/dist/ui/browser/InputEvent.js +2 -0
  261. package/dist/ui/browser/SVGProxy.d.ts +9 -0
  262. package/dist/ui/browser/SVGProxy.js +59 -0
  263. package/dist/ui/browser/VideoProxy.d.ts +42 -0
  264. package/dist/ui/browser/VideoProxy.js +235 -0
  265. package/dist/ui/browser/index.d.ts +6 -0
  266. package/dist/ui/browser/index.js +22 -0
  267. package/dist/ui/fields/Field.d.ts +80 -0
  268. package/dist/ui/fields/Field.js +298 -0
  269. package/dist/ui/fields/FieldList.d.ts +80 -0
  270. package/dist/ui/fields/FieldList.js +421 -0
  271. package/dist/ui/fields/FieldListValidator.d.ts +9 -0
  272. package/dist/ui/fields/FieldListValidator.js +37 -0
  273. package/dist/ui/fields/FieldModel.d.ts +15 -0
  274. package/dist/ui/fields/FieldModel.js +28 -0
  275. package/dist/ui/fields/FieldSerializer.d.ts +13 -0
  276. package/dist/ui/fields/FieldSerializer.js +71 -0
  277. package/dist/ui/fields/FieldValidator.d.ts +19 -0
  278. package/dist/ui/fields/FieldValidator.js +98 -0
  279. package/dist/ui/fields/ObjectField.d.ts +75 -0
  280. package/dist/ui/fields/ObjectField.js +288 -0
  281. package/dist/ui/fields/errors.json +44 -0
  282. package/dist/ui/fields/index.d.ts +7 -0
  283. package/dist/ui/fields/index.js +23 -0
  284. package/dist/ui/fields/validators/AssetValidator.d.ts +9 -0
  285. package/dist/ui/fields/validators/AssetValidator.js +25 -0
  286. package/dist/ui/fields/validators/DateValidator.d.ts +9 -0
  287. package/dist/ui/fields/validators/DateValidator.js +41 -0
  288. package/dist/ui/fields/validators/EnumValidator.d.ts +10 -0
  289. package/dist/ui/fields/validators/EnumValidator.js +77 -0
  290. package/dist/ui/fields/validators/GenericValidator.d.ts +6 -0
  291. package/dist/ui/fields/validators/GenericValidator.js +22 -0
  292. package/dist/ui/fields/validators/LinkValidator.d.ts +9 -0
  293. package/dist/ui/fields/validators/LinkValidator.js +146 -0
  294. package/dist/ui/fields/validators/RichTextValidator.d.ts +6 -0
  295. package/dist/ui/fields/validators/RichTextValidator.js +35 -0
  296. package/dist/ui/fields/validators/TextValidator.d.ts +10 -0
  297. package/dist/ui/fields/validators/TextValidator.js +138 -0
  298. package/dist/ui/fields/validators/TimestampValidator.d.ts +9 -0
  299. package/dist/ui/fields/validators/TimestampValidator.js +41 -0
  300. package/dist/ui/fields/validators/ValidatorHelper.d.ts +23 -0
  301. package/dist/ui/fields/validators/ValidatorHelper.js +55 -0
  302. package/dist/ui/fields/validators/index.d.ts +8 -0
  303. package/dist/ui/fields/validators/index.js +24 -0
  304. package/dist/ui/geometry/AspectRatio.d.ts +27 -0
  305. package/dist/ui/geometry/AspectRatio.js +77 -0
  306. package/dist/ui/geometry/Bounds.d.ts +4 -0
  307. package/dist/ui/geometry/Bounds.js +11 -0
  308. package/dist/ui/geometry/Frame.d.ts +3 -0
  309. package/dist/ui/geometry/Frame.js +2 -0
  310. package/dist/ui/geometry/Insets.d.ts +14 -0
  311. package/dist/ui/geometry/Insets.js +14 -0
  312. package/dist/ui/geometry/PixelSize.d.ts +1 -0
  313. package/dist/ui/geometry/PixelSize.js +2 -0
  314. package/dist/ui/geometry/Point.d.ts +7 -0
  315. package/dist/ui/geometry/Point.js +15 -0
  316. package/dist/ui/geometry/Rect.d.ts +19 -0
  317. package/dist/ui/geometry/Rect.js +68 -0
  318. package/dist/ui/geometry/ScreenSize.d.ts +1 -0
  319. package/dist/ui/geometry/ScreenSize.js +2 -0
  320. package/dist/ui/geometry/Size.d.ts +7 -0
  321. package/dist/ui/geometry/Size.js +9 -0
  322. package/dist/ui/geometry/index.d.ts +9 -0
  323. package/dist/ui/geometry/index.js +25 -0
  324. package/dist/ui/index.d.ts +18 -0
  325. package/dist/ui/index.js +34 -0
  326. package/dist/ui/responsive/Breakpoint.d.ts +8 -0
  327. package/dist/ui/responsive/Breakpoint.js +24 -0
  328. package/dist/ui/responsive/BreakpointObserver.d.ts +16 -0
  329. package/dist/ui/responsive/BreakpointObserver.js +104 -0
  330. package/dist/ui/responsive/Breakpoints.d.ts +5 -0
  331. package/dist/ui/responsive/Breakpoints.js +15 -0
  332. package/dist/ui/responsive/ResponsiveValue.d.ts +7 -0
  333. package/dist/ui/responsive/ResponsiveValue.js +26 -0
  334. package/dist/ui/responsive/index.d.ts +4 -0
  335. package/dist/ui/responsive/index.js +20 -0
  336. package/dist/ui/richtext/LexicalUtils.d.ts +31 -0
  337. package/dist/ui/richtext/LexicalUtils.js +314 -0
  338. package/dist/ui/richtext/StyledTextNode.d.ts +33 -0
  339. package/dist/ui/richtext/StyledTextNode.js +101 -0
  340. package/dist/ui/richtext/index.d.ts +2 -0
  341. package/dist/ui/richtext/index.js +18 -0
  342. package/dist/utils/ArrayUtils.d.ts +17 -0
  343. package/dist/utils/ArrayUtils.js +66 -0
  344. package/dist/utils/ByteSize.d.ts +19 -0
  345. package/dist/utils/ByteSize.js +33 -0
  346. package/dist/utils/DateUtils.d.ts +15 -0
  347. package/dist/utils/DateUtils.js +100 -0
  348. package/dist/utils/Deferral.d.ts +28 -0
  349. package/dist/utils/Deferral.js +107 -0
  350. package/dist/utils/Duration.d.ts +7 -0
  351. package/dist/utils/Duration.js +35 -0
  352. package/dist/utils/Fn.d.ts +14 -0
  353. package/dist/utils/Fn.js +52 -0
  354. package/dist/utils/ObjectUtils.d.ts +89 -0
  355. package/dist/utils/ObjectUtils.js +159 -0
  356. package/dist/utils/Random.d.ts +15 -0
  357. package/dist/utils/Random.js +72 -0
  358. package/dist/utils/StringUtils.d.ts +10 -0
  359. package/dist/utils/StringUtils.js +51 -0
  360. package/dist/utils/UrlUtils.d.ts +22 -0
  361. package/dist/utils/UrlUtils.js +119 -0
  362. package/dist/utils/Value.d.ts +23 -0
  363. package/dist/utils/Value.js +122 -0
  364. package/dist/utils/index.d.ts +12 -0
  365. package/dist/utils/index.js +28 -0
  366. package/dist/utils/isDefined.d.ts +1 -0
  367. package/dist/utils/isDefined.js +6 -0
  368. package/package.json +64 -0
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateUtils = void 0;
4
+ const date_fns_1 = require("date-fns");
5
+ // extension
6
+ var DateUtils;
7
+ (function (DateUtils) {
8
+ // constants
9
+ DateUtils.minute = 60;
10
+ DateUtils.hour = DateUtils.minute * 60;
11
+ DateUtils.day = DateUtils.hour * 24;
12
+ // helpers
13
+ function ageInSeconds(from, to) {
14
+ return (0, date_fns_1.differenceInSeconds)(to !== null && to !== void 0 ? to : Date.now(), from, { roundingMethod: 'round' });
15
+ }
16
+ DateUtils.ageInSeconds = ageInSeconds;
17
+ function ageInWeeks(from, to) {
18
+ return (0, date_fns_1.differenceInCalendarWeeks)(to !== null && to !== void 0 ? to : Date.now(), from, { weekStartsOn: 1 });
19
+ }
20
+ DateUtils.ageInWeeks = ageInWeeks;
21
+ function format(time, { variant = 'datetime' } = {}) {
22
+ switch (variant) {
23
+ case 'full-numeric':
24
+ return (0, date_fns_1.format)(time, 'yyyy-MM-dd');
25
+ case 'date':
26
+ return (0, date_fns_1.format)(time, 'MMM d, yyyy');
27
+ default:
28
+ return (0, date_fns_1.format)(time, 'MMM d, yyyy \'at\' H:mmaaa');
29
+ }
30
+ }
31
+ DateUtils.format = format;
32
+ function formatAge(from, resolution = 'second') {
33
+ // determine the number of seconds
34
+ const to = Date.now();
35
+ const seconds = ageInSeconds(from, to);
36
+ // handle sub-minute timing
37
+ if (seconds < 60) {
38
+ return resolution !== 'second' || seconds < 10
39
+ ? 'Just now'
40
+ : `${seconds}s ago`;
41
+ }
42
+ // handle sub-hour timing
43
+ const minutes = Math.floor(seconds / 60);
44
+ if (minutes === 1) {
45
+ return '1 min ago';
46
+ }
47
+ else if (minutes < 60) {
48
+ return `${minutes} mins ago`;
49
+ }
50
+ // handle sub-day timing
51
+ const hours = Math.floor(minutes / 60);
52
+ if (hours === 1) {
53
+ return '1 hour ago';
54
+ }
55
+ else if (hours < 60) {
56
+ return `${hours} hours ago`;
57
+ }
58
+ // handle sub-week timing
59
+ const days = Math.floor(hours / 24);
60
+ if (days === 1) {
61
+ return '1 day ago';
62
+ }
63
+ else if (days < 7) {
64
+ return `${days} days ago`;
65
+ }
66
+ // handle sub-month timing
67
+ const weeks = (0, date_fns_1.differenceInCalendarWeeks)(to, from, { weekStartsOn: 1 });
68
+ if (weeks <= 1) {
69
+ return '1 week ago';
70
+ }
71
+ else if (weeks < 5) {
72
+ return `${weeks} weeks ago`;
73
+ }
74
+ // handle sub-year timing
75
+ const months = (0, date_fns_1.differenceInCalendarMonths)(to, from);
76
+ if (months <= 1) {
77
+ return 'Last month';
78
+ }
79
+ else if (months < 12) {
80
+ return `${months} months ago`;
81
+ }
82
+ // handle sub-century timing
83
+ const years = (0, date_fns_1.differenceInYears)(to, from);
84
+ if (years < 2) {
85
+ return '1 year ago';
86
+ }
87
+ else if (years < 100) {
88
+ return `${years} years ago`;
89
+ }
90
+ // handle centuries
91
+ const centuries = Math.floor(years / 100);
92
+ if (centuries === 1) {
93
+ return '1 century ago';
94
+ }
95
+ else {
96
+ return `${centuries} centuries ago`;
97
+ }
98
+ }
99
+ DateUtils.formatAge = formatAge;
100
+ })(DateUtils || (exports.DateUtils = DateUtils = {}));
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Provides shared access to resolve a `Promise`.
3
+ */
4
+ export declare class Deferral<TResult> {
5
+ private readonly _options;
6
+ private _promise;
7
+ private _state;
8
+ private _resolve?;
9
+ private _resolveValue?;
10
+ private _reject?;
11
+ private _rejectValue?;
12
+ constructor(options?: Deferral.Options);
13
+ get promise(): Promise<TResult>;
14
+ get state(): State;
15
+ get isComplete(): boolean;
16
+ get isResolved(): boolean;
17
+ resolve(value: TResult): void;
18
+ reject(value: any): void;
19
+ reset(): void;
20
+ }
21
+ export declare namespace Deferral {
22
+ type Options = {
23
+ ignoreRepeats?: boolean;
24
+ resetOnReject?: boolean;
25
+ };
26
+ }
27
+ type State = 'unresolved' | 'resolved' | 'rejected';
28
+ export {};
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Deferral = void 0;
4
+ const errors_1 = require("../errors");
5
+ /**
6
+ * Provides shared access to resolve a `Promise`.
7
+ */
8
+ class Deferral {
9
+ constructor(options = {}) {
10
+ // initialize options
11
+ this._options = Object.assign({ ignoreRepeats: false, resetOnReject: false }, options);
12
+ this._state = 'unresolved';
13
+ // reset (creates initial promise)
14
+ this.reset();
15
+ }
16
+ get promise() {
17
+ return this._promise;
18
+ }
19
+ get state() {
20
+ return this._state;
21
+ }
22
+ get isComplete() {
23
+ return this._state !== 'unresolved';
24
+ }
25
+ get isResolved() {
26
+ return this._state === 'resolved';
27
+ }
28
+ resolve(value) {
29
+ // short-circuit if already complete
30
+ const resolve = this._resolve;
31
+ if (this.isComplete) {
32
+ // ignore if it's not a problem
33
+ if (this._options.ignoreRepeats) {
34
+ return;
35
+ }
36
+ // or throw
37
+ else {
38
+ throw new errors_1.InvalidOperationError('Attempt to access resolver that is already completed.');
39
+ }
40
+ }
41
+ // mark as resolved
42
+ this._state = 'resolved';
43
+ // invoke resolver if it's set
44
+ if (resolve) {
45
+ resolve(value);
46
+ }
47
+ // otherwise, queue value
48
+ else {
49
+ this._resolveValue = { value };
50
+ }
51
+ }
52
+ reject(value) {
53
+ // short-circuit if already complete
54
+ const reject = this._reject;
55
+ if (this.isComplete) {
56
+ // reset if required
57
+ if (this._options.resetOnReject) {
58
+ this.reset();
59
+ return;
60
+ }
61
+ // ignore if it's not a problem
62
+ else if (this._options.ignoreRepeats) {
63
+ return;
64
+ }
65
+ // or throw
66
+ else {
67
+ throw new errors_1.InvalidOperationError('Attempt to access reject that is already resolved.');
68
+ }
69
+ }
70
+ // mark as complete
71
+ this._state = 'rejected';
72
+ // invoke resolver if it's set
73
+ if (reject) {
74
+ reject(value);
75
+ }
76
+ // otherwise, queue value
77
+ else {
78
+ this._rejectValue = { value };
79
+ }
80
+ }
81
+ reset() {
82
+ // clear resolve/reject
83
+ this._state = 'unresolved';
84
+ delete this._resolve;
85
+ delete this._resolveValue;
86
+ delete this._reject;
87
+ delete this._rejectValue;
88
+ // create promise
89
+ this._promise = new Promise((resolve, reject) => {
90
+ // capture resolver
91
+ this._resolve = resolve;
92
+ // capture reject
93
+ this._reject = reject;
94
+ // resolve/reject immediately if complete
95
+ const { _state, _resolveValue, _rejectValue } = this;
96
+ if (_state !== 'unresolved') {
97
+ if (_resolveValue) {
98
+ resolve(_resolveValue.value);
99
+ }
100
+ else {
101
+ reject(_rejectValue === null || _rejectValue === void 0 ? void 0 : _rejectValue.value);
102
+ }
103
+ }
104
+ });
105
+ }
106
+ }
107
+ exports.Deferral = Deferral;
@@ -0,0 +1,7 @@
1
+ import { StringValue } from 'ms';
2
+ export type Duration = StringValue;
3
+ export declare namespace Duration {
4
+ function toMilliseconds(duration: Duration): number;
5
+ function toSeconds(duration: Duration): number;
6
+ function formatSeconds(timeInSeconds: number): string;
7
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Duration = void 0;
7
+ const ms_1 = __importDefault(require("ms"));
8
+ // extension
9
+ var Duration;
10
+ (function (Duration) {
11
+ // methods
12
+ function toMilliseconds(duration) {
13
+ return (0, ms_1.default)(duration);
14
+ }
15
+ Duration.toMilliseconds = toMilliseconds;
16
+ function toSeconds(duration) {
17
+ return toMilliseconds(duration) / 1000;
18
+ }
19
+ Duration.toSeconds = toSeconds;
20
+ function formatSeconds(timeInSeconds) {
21
+ // compute seconds
22
+ let normalizedTime = Math.floor(timeInSeconds);
23
+ const seconds = normalizedTime % 60;
24
+ // compute minutes + hours
25
+ normalizedTime = Math.floor(normalizedTime / 60);
26
+ const minutes = normalizedTime % 60;
27
+ const hours = Math.floor(normalizedTime / 60);
28
+ // return time (include hours if any)
29
+ const time = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
30
+ return hours
31
+ ? `${hours.toString()}:${time}`
32
+ : time;
33
+ }
34
+ Duration.formatSeconds = formatSeconds;
35
+ })(Duration || (exports.Duration = Duration = {}));
@@ -0,0 +1,14 @@
1
+ export declare namespace Fn {
2
+ function NoOp(): undefined;
3
+ function Identity<T>(value: T): T;
4
+ function True(): boolean;
5
+ function False(): boolean;
6
+ function Null(): null;
7
+ namespace Async {
8
+ function NoOp(): Promise<undefined>;
9
+ function Identity<T>(value: T): Promise<T>;
10
+ function True(): Promise<boolean>;
11
+ function False(): Promise<boolean>;
12
+ function Null(): Promise<null>;
13
+ }
14
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Fn = void 0;
4
+ // namespace
5
+ var Fn;
6
+ (function (Fn) {
7
+ // helpers
8
+ function NoOp() {
9
+ return undefined;
10
+ }
11
+ Fn.NoOp = NoOp;
12
+ function Identity(value) {
13
+ return value;
14
+ }
15
+ Fn.Identity = Identity;
16
+ function True() {
17
+ return true;
18
+ }
19
+ Fn.True = True;
20
+ function False() {
21
+ return false;
22
+ }
23
+ Fn.False = False;
24
+ function Null() {
25
+ return null;
26
+ }
27
+ Fn.Null = Null;
28
+ // async helpers
29
+ let Async;
30
+ (function (Async) {
31
+ async function NoOp() {
32
+ return undefined;
33
+ }
34
+ Async.NoOp = NoOp;
35
+ async function Identity(value) {
36
+ return value;
37
+ }
38
+ Async.Identity = Identity;
39
+ async function True() {
40
+ return true;
41
+ }
42
+ Async.True = True;
43
+ async function False() {
44
+ return false;
45
+ }
46
+ Async.False = False;
47
+ async function Null() {
48
+ return null;
49
+ }
50
+ Async.Null = Null;
51
+ })(Async = Fn.Async || (Fn.Async = {}));
52
+ })(Fn || (exports.Fn = Fn = {}));
@@ -0,0 +1,89 @@
1
+ import { Transform } from '../types';
2
+ import { Value } from './Value';
3
+ export declare namespace ObjectUtils {
4
+ function hasKeys<TKey extends string>(object: object, ...keys: TKey[]): object is Record<TKey, any>;
5
+ function hasStringKeys<TKey extends string>(object: object, ...keys: TKey[]): object is Record<TKey, string>;
6
+ type CreateSeriesArgs<TKey extends string = string, TValue = number> = {
7
+ start: number;
8
+ end: number;
9
+ step?: number;
10
+ getKey?: (value: number) => TKey;
11
+ getValue?: (value: number) => TValue;
12
+ };
13
+ function createSeries<TKey extends string = string, TValue = number>({ start, end, step, getKey, getValue }: CreateSeriesArgs<TKey, TValue>): Record<TKey, TValue>;
14
+ type SplitProps<TProps extends object, TSubKey extends keyof Required<TProps>> = {
15
+ splitProps: Pick<TProps, TSubKey>;
16
+ props: Omit<TProps, TSubKey>;
17
+ };
18
+ function splitProps<TProps extends object, TSubKey extends keyof Required<TProps>>(mixedProps: TProps, keys: ReadonlyArray<TSubKey>): SplitProps<TProps, TSubKey>;
19
+ function slice<TProps extends object, TSubKey extends keyof Required<TProps>>(mixedProps: TProps, ...keys: ReadonlyArray<TSubKey>): Pick<TProps, TSubKey>;
20
+ /**
21
+ * Creates a new object with the updated entry (adding it if required)
22
+ * @param object - the existing object to copy + change
23
+ * @param key - the key of the entry to update/add
24
+ * @param value - the value of the entry to update/add
25
+ */
26
+ function upsert<T extends object, TKey extends keyof T>(object: T, key: TKey, value: T[TKey]): T & {
27
+ [key]: T[TKey];
28
+ };
29
+ function clone<T>(value: T): T;
30
+ function walk(value: any, onWalk: walk.OnWalk): void;
31
+ namespace walk {
32
+ type OnWalk = Transform<WalkerArgs, boolean | undefined | void>;
33
+ type WalkerArgs = ObjectArgs | ArrayArgs | StringArgs | NumberArgs | BigIntArgs | BooleanArgs | NullableArgs;
34
+ type ObjectArgs = {
35
+ __type: 'object';
36
+ value: object;
37
+ };
38
+ type ArrayArgs = {
39
+ __type: 'array';
40
+ value: any[];
41
+ };
42
+ type StringArgs = {
43
+ __type: 'string';
44
+ value: string;
45
+ };
46
+ type NumberArgs = {
47
+ __type: 'number';
48
+ value: number;
49
+ };
50
+ type BigIntArgs = {
51
+ __type: 'bigint';
52
+ value: bigint;
53
+ };
54
+ type BooleanArgs = {
55
+ __type: 'boolean';
56
+ value: boolean;
57
+ };
58
+ type NullableArgs = {
59
+ __type: 'nullable';
60
+ value: null | undefined;
61
+ };
62
+ }
63
+ function transform<TOut = any>({ value, transform, recurse }: transform.Args): TOut;
64
+ namespace transform {
65
+ type Args = {
66
+ value: any;
67
+ transform: Transform<Node, any>;
68
+ recurse?: boolean | Transform<Node, boolean>;
69
+ };
70
+ type Node = Node.Undefined | Node.Null | Node.Boolean | Node.String | Node.Number | Node.BigInt | Node.Symbol | Node.Object | Node.Array | Node.Fn;
71
+ namespace Node {
72
+ type Base<T extends Value.TypeOf, V> = {
73
+ type: T;
74
+ value: V;
75
+ index?: string | number;
76
+ };
77
+ type Undefined = Base<'undefined', undefined>;
78
+ type Null = Base<'null', null>;
79
+ type Boolean = Base<'boolean', boolean>;
80
+ type String = Base<'string', string>;
81
+ type Number = Base<'number', number>;
82
+ type BigInt = Base<'bigint', bigint>;
83
+ type Symbol = Base<'symbol', symbol>;
84
+ type Object = Base<'object', object>;
85
+ type Array = Base<'array', unknown[]>;
86
+ type Fn = Base<'function', any>;
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ObjectUtils = void 0;
7
+ const clone_deep_1 = __importDefault(require("clone-deep"));
8
+ const Value_1 = require("./Value");
9
+ // namespace
10
+ var ObjectUtils;
11
+ (function (ObjectUtils) {
12
+ // guards
13
+ function hasKeys(object, ...keys) {
14
+ return keys.every(key => Object.hasOwn(object, key));
15
+ }
16
+ ObjectUtils.hasKeys = hasKeys;
17
+ function hasStringKeys(object, ...keys) {
18
+ const value = object;
19
+ return keys.every(key => key in value && typeof value[key] === 'string');
20
+ }
21
+ ObjectUtils.hasStringKeys = hasStringKeys;
22
+ function createSeries({ start, end, step = 1, getKey = (key) => key.toString(), getValue = (value) => value }) {
23
+ // iterate over range and build object
24
+ const generated = {};
25
+ for (let i = start; i <= end; i += step) {
26
+ generated[getKey(i)] = getValue(i);
27
+ }
28
+ // return generated
29
+ return generated;
30
+ }
31
+ ObjectUtils.createSeries = createSeries;
32
+ function splitProps(mixedProps, keys) {
33
+ console.debug('[splitProps] splitting', { mixedProps, keys });
34
+ // split props
35
+ const splitProps = {};
36
+ const props = {};
37
+ for (const [key, value] of Object.entries(mixedProps)) {
38
+ if (keys.includes(key)) {
39
+ splitProps[key] = value;
40
+ }
41
+ else {
42
+ props[key] = value;
43
+ }
44
+ }
45
+ // and return them
46
+ return { splitProps, props };
47
+ }
48
+ ObjectUtils.splitProps = splitProps;
49
+ function slice(mixedProps, ...keys) {
50
+ return splitProps(mixedProps, keys).splitProps;
51
+ }
52
+ ObjectUtils.slice = slice;
53
+ /**
54
+ * Creates a new object with the updated entry (adding it if required)
55
+ * @param object - the existing object to copy + change
56
+ * @param key - the key of the entry to update/add
57
+ * @param value - the value of the entry to update/add
58
+ */
59
+ function upsert(object, key, value) {
60
+ return Object.assign(Object.assign({}, object), { [key]: value });
61
+ }
62
+ ObjectUtils.upsert = upsert;
63
+ function clone(value) {
64
+ return (0, clone_deep_1.default)(value);
65
+ }
66
+ ObjectUtils.clone = clone;
67
+ function walk(value, onWalk) {
68
+ // helper
69
+ function walker(value) {
70
+ var _a, _b;
71
+ // handle nullables
72
+ if (value === undefined || value === null) {
73
+ onWalk({ __type: 'nullable', value });
74
+ }
75
+ // handle arrays
76
+ else if (Array.isArray(value)) {
77
+ // walk array
78
+ const recurse = (_a = onWalk({ __type: 'array', value })) !== null && _a !== void 0 ? _a : false;
79
+ // walk items if required
80
+ if (recurse) {
81
+ value.forEach(value => walker(value));
82
+ }
83
+ }
84
+ // or transform leaf node
85
+ else {
86
+ switch (typeof value) {
87
+ case 'object': {
88
+ // walk object
89
+ const recurse = (_b = onWalk({ __type: 'object', value })) !== null && _b !== void 0 ? _b : false;
90
+ // walk entries (if required)
91
+ if (recurse) {
92
+ Object.values(value).forEach(value => walker(value));
93
+ }
94
+ break;
95
+ }
96
+ case 'string':
97
+ onWalk({ __type: 'string', value });
98
+ break;
99
+ case 'number':
100
+ onWalk({ __type: 'number', value });
101
+ break;
102
+ case 'bigint':
103
+ onWalk({ __type: 'bigint', value });
104
+ break;
105
+ case 'boolean':
106
+ onWalk({ __type: 'boolean', value });
107
+ break;
108
+ }
109
+ }
110
+ }
111
+ // start walking
112
+ walker(value);
113
+ }
114
+ ObjectUtils.walk = walk;
115
+ function transform({ value, transform, recurse = true }) {
116
+ // helpers
117
+ const shouldWalk = typeof recurse === 'boolean'
118
+ ? () => recurse
119
+ : recurse;
120
+ const onTransform = (node) => {
121
+ const value = transform(node);
122
+ return value === node
123
+ ? node.value
124
+ : value;
125
+ };
126
+ // create helpers
127
+ function walk(value, index) {
128
+ // process based on type
129
+ const type = Value_1.Value.typeOf(value);
130
+ const node = { type, value, index };
131
+ switch (type) {
132
+ // handle walkable objects
133
+ case 'array':
134
+ case 'object':
135
+ // ignore if restricted from walking value
136
+ if (!shouldWalk(node)) {
137
+ return onTransform(node);
138
+ }
139
+ // or walk arrays
140
+ else if (type === 'array') {
141
+ return value.map((value, index) => walk(value, index));
142
+ }
143
+ // or walk object
144
+ else {
145
+ return Object.entries(value).reduce((object, [key, value]) => {
146
+ object[key] = walk(value, key);
147
+ return object;
148
+ }, {});
149
+ }
150
+ // or transform other nodes
151
+ default:
152
+ return onTransform(node);
153
+ }
154
+ }
155
+ // start walking
156
+ return walk(value);
157
+ }
158
+ ObjectUtils.transform = transform;
159
+ })(ObjectUtils || (exports.ObjectUtils = ObjectUtils = {}));
@@ -0,0 +1,15 @@
1
+ export declare namespace Random {
2
+ type Randomizer = () => number;
3
+ function createRandomizer(seed: string): Randomizer;
4
+ function boolean(odds?: number, randomizer?: Randomizer): boolean;
5
+ function negate(value: number, odds?: number, randomizer?: Randomizer): number;
6
+ function number(max: number, min?: number, randomizer?: Randomizer): number;
7
+ function int(max: number, min?: number, randomizer?: Randomizer): number;
8
+ function intInclusive(max: number, min?: number, randomizer?: Randomizer): number;
9
+ function easeInCubic(randomizer?: Randomizer): number;
10
+ function easeInOutQuint(randomizer?: Randomizer): number;
11
+ function array<T>(array: ReadonlyArray<T>, randomizer?: Randomizer): T[];
12
+ function element<T>(array: ReadonlyArray<T>, randomizer?: Randomizer): T;
13
+ function addRandomElement<T>(array: Array<T>, element: T, randomizer?: Randomizer): void;
14
+ function removeRandomElement<T>(array: Array<T>, randomizer?: Randomizer): T;
15
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Random = void 0;
7
+ const seedrandom_1 = __importDefault(require("seedrandom"));
8
+ // namespace
9
+ var Random;
10
+ (function (Random) {
11
+ // randomizer factory
12
+ function createRandomizer(seed) {
13
+ return (0, seedrandom_1.default)(seed);
14
+ }
15
+ Random.createRandomizer = createRandomizer;
16
+ // methods
17
+ function boolean(odds = 0.5, randomizer = Math.random) {
18
+ return randomizer() < odds;
19
+ }
20
+ Random.boolean = boolean;
21
+ function negate(value, odds = 0.5, randomizer = Math.random) {
22
+ return randomizer() < odds ? value : -value;
23
+ }
24
+ Random.negate = negate;
25
+ function number(max, min = 0, randomizer = Math.random) {
26
+ return Math.floor(randomizer() * (max - min) + min);
27
+ }
28
+ Random.number = number;
29
+ function int(max, min = 0, randomizer = Math.random) {
30
+ min = Math.ceil(min);
31
+ max = Math.floor(max);
32
+ return Math.floor(randomizer() * (max - min)) + min;
33
+ }
34
+ Random.int = int;
35
+ function intInclusive(max, min = 0, randomizer = Math.random) {
36
+ min = Math.ceil(min);
37
+ max = Math.floor(max);
38
+ return Math.floor(randomizer() * (max - min + 1)) + min;
39
+ }
40
+ Random.intInclusive = intInclusive;
41
+ function easeInCubic(randomizer = Math.random) {
42
+ const x = randomizer();
43
+ return x * x * x;
44
+ }
45
+ Random.easeInCubic = easeInCubic;
46
+ function easeInOutQuint(randomizer = Math.random) {
47
+ const x = randomizer();
48
+ return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;
49
+ }
50
+ Random.easeInOutQuint = easeInOutQuint;
51
+ function array(array, randomizer = Math.random) {
52
+ const original = Array.from(array);
53
+ const randomized = new Array();
54
+ while (original.length > 0) {
55
+ randomized.push(removeRandomElement(original));
56
+ }
57
+ return randomized;
58
+ }
59
+ Random.array = array;
60
+ function element(array, randomizer = Math.random) {
61
+ return array[int(array.length, 0, randomizer)];
62
+ }
63
+ Random.element = element;
64
+ function addRandomElement(array, element, randomizer = Math.random) {
65
+ array.splice(int(array.length), 0, element);
66
+ }
67
+ Random.addRandomElement = addRandomElement;
68
+ function removeRandomElement(array, randomizer = Math.random) {
69
+ return array.splice(int(array.length, 0, randomizer), 1)[0];
70
+ }
71
+ Random.removeRandomElement = removeRandomElement;
72
+ })(Random || (exports.Random = Random = {}));