@jscrpt/common 1.2.0 → 2.0.0-beta.20211108120022

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 (238) hide show
  1. package/changelog.md +24 -0
  2. package/dist/es2015/decorators/bindThis.decorator.js +24 -24
  3. package/dist/es2015/decorators/bindThis.decorator.js.map +1 -0
  4. package/dist/es2015/decorators/callOnce.decorator.js +29 -28
  5. package/dist/es2015/decorators/callOnce.decorator.js.map +1 -0
  6. package/dist/es2015/decorators/debounceCall.decorator.js +25 -26
  7. package/dist/es2015/decorators/debounceCall.decorator.js.map +1 -0
  8. package/dist/es2015/decorators/index.js +4 -4
  9. package/dist/es2015/decorators/index.js.map +1 -0
  10. package/dist/es2015/encoder/encoder.js +220 -231
  11. package/dist/es2015/encoder/encoder.js.map +1 -0
  12. package/dist/es2015/enums/index.js +2 -2
  13. package/dist/es2015/enums/index.js.map +1 -0
  14. package/dist/es2015/enums/orderByDirection.js +15 -15
  15. package/dist/es2015/enums/orderByDirection.js.map +1 -0
  16. package/dist/es2015/index.js +10 -24
  17. package/dist/es2015/index.js.map +1 -0
  18. package/dist/es2015/indexNode.js +2 -2
  19. package/dist/es2015/indexNode.js.map +1 -0
  20. package/dist/es2015/initJsDevMode.js +8 -0
  21. package/dist/es2015/initJsDevMode.js.map +1 -0
  22. package/dist/es2015/jsDevMode.js +8 -8
  23. package/dist/es2015/jsDevMode.js.map +1 -0
  24. package/dist/es2015/normalizer/charMaps.js +20 -27
  25. package/dist/es2015/normalizer/charMaps.js.map +1 -0
  26. package/dist/es2015/normalizer/index.js +3 -3
  27. package/dist/es2015/normalizer/index.js.map +1 -0
  28. package/dist/es2015/normalizer/normalizer.js +14 -14
  29. package/dist/es2015/normalizer/normalizer.js.map +1 -0
  30. package/dist/es2015/paginator/paginator.js +230 -224
  31. package/dist/es2015/paginator/paginator.js.map +1 -0
  32. package/dist/es2015/types/dictionaries.js +2 -1
  33. package/dist/es2015/types/dictionaries.js.map +1 -0
  34. package/dist/es2015/types/enums.js +2 -0
  35. package/dist/es2015/types/enums.js.map +1 -0
  36. package/dist/es2015/types/functions.js +2 -0
  37. package/dist/es2015/types/functions.js.map +1 -0
  38. package/dist/es2015/types/index.js +5 -3
  39. package/dist/es2015/types/index.js.map +1 -0
  40. package/dist/es2015/types/valueNamePair.js +2 -1
  41. package/dist/es2015/types/valueNamePair.js.map +1 -0
  42. package/dist/es2015/utils/common.js +209 -215
  43. package/dist/es2015/utils/common.js.map +1 -0
  44. package/dist/es2015/utils/index.js +4 -4
  45. package/dist/es2015/utils/index.js.map +1 -0
  46. package/dist/es2015/utils/lang.js +79 -79
  47. package/dist/es2015/utils/lang.js.map +1 -0
  48. package/dist/es2015/utils/nameof.js +6 -6
  49. package/dist/es2015/utils/nameof.js.map +1 -0
  50. package/dist/es2020/decorators/bindThis.decorator.js +23 -0
  51. package/dist/es2020/decorators/bindThis.decorator.js.map +1 -0
  52. package/dist/es2020/decorators/callOnce.decorator.js +28 -0
  53. package/dist/es2020/decorators/callOnce.decorator.js.map +1 -0
  54. package/dist/es2020/decorators/debounceCall.decorator.js +24 -0
  55. package/dist/es2020/decorators/debounceCall.decorator.js.map +1 -0
  56. package/dist/es2020/decorators/index.js +4 -0
  57. package/dist/es2020/decorators/index.js.map +1 -0
  58. package/dist/es2020/encoder/encoder.js +220 -0
  59. package/dist/es2020/encoder/encoder.js.map +1 -0
  60. package/dist/es2020/enums/index.js +2 -0
  61. package/dist/es2020/enums/index.js.map +1 -0
  62. package/dist/es2020/enums/orderByDirection.js +15 -0
  63. package/dist/es2020/enums/orderByDirection.js.map +1 -0
  64. package/dist/es2020/index.js +10 -0
  65. package/dist/es2020/index.js.map +1 -0
  66. package/dist/es2020/indexNode.js +2 -0
  67. package/dist/es2020/indexNode.js.map +1 -0
  68. package/dist/es2020/initJsDevMode.js +8 -0
  69. package/dist/es2020/initJsDevMode.js.map +1 -0
  70. package/dist/es2020/jsDevMode.js +8 -0
  71. package/dist/es2020/jsDevMode.js.map +1 -0
  72. package/dist/es2020/normalizer/charMaps.js +20 -0
  73. package/dist/es2020/normalizer/charMaps.js.map +1 -0
  74. package/dist/es2020/normalizer/index.js +3 -0
  75. package/dist/es2020/normalizer/index.js.map +1 -0
  76. package/dist/es2020/normalizer/normalizer.js +14 -0
  77. package/dist/es2020/normalizer/normalizer.js.map +1 -0
  78. package/dist/es2020/paginator/paginator.js +230 -0
  79. package/dist/es2020/paginator/paginator.js.map +1 -0
  80. package/dist/es2020/types/dictionaries.js +2 -0
  81. package/dist/es2020/types/dictionaries.js.map +1 -0
  82. package/dist/es2020/types/enums.js +2 -0
  83. package/dist/es2020/types/enums.js.map +1 -0
  84. package/dist/es2020/types/functions.js +2 -0
  85. package/dist/es2020/types/functions.js.map +1 -0
  86. package/dist/es2020/types/index.js +5 -0
  87. package/dist/es2020/types/index.js.map +1 -0
  88. package/dist/es2020/types/valueNamePair.js +2 -0
  89. package/dist/es2020/types/valueNamePair.js.map +1 -0
  90. package/dist/es2020/utils/common.js +208 -0
  91. package/dist/es2020/utils/common.js.map +1 -0
  92. package/dist/es2020/utils/index.js +4 -0
  93. package/dist/es2020/utils/index.js.map +1 -0
  94. package/dist/es2020/utils/lang.js +79 -0
  95. package/dist/es2020/utils/lang.js.map +1 -0
  96. package/dist/es2020/utils/nameof.js +6 -0
  97. package/dist/es2020/utils/nameof.js.map +1 -0
  98. package/dist/es5/decorators/bindThis.decorator.js +24 -24
  99. package/dist/es5/decorators/bindThis.decorator.js.map +1 -0
  100. package/dist/es5/decorators/callOnce.decorator.js +33 -28
  101. package/dist/es5/decorators/callOnce.decorator.js.map +1 -0
  102. package/dist/es5/decorators/debounceCall.decorator.js +30 -27
  103. package/dist/es5/decorators/debounceCall.decorator.js.map +1 -0
  104. package/dist/es5/decorators/index.js +4 -4
  105. package/dist/es5/decorators/index.js.map +1 -0
  106. package/dist/es5/encoder/encoder.js +222 -233
  107. package/dist/es5/encoder/encoder.js.map +1 -0
  108. package/dist/es5/enums/index.js +2 -2
  109. package/dist/es5/enums/index.js.map +1 -0
  110. package/dist/es5/enums/orderByDirection.js +15 -15
  111. package/dist/es5/enums/orderByDirection.js.map +1 -0
  112. package/dist/es5/index.js +10 -24
  113. package/dist/es5/index.js.map +1 -0
  114. package/dist/es5/indexNode.js +2 -2
  115. package/dist/es5/indexNode.js.map +1 -0
  116. package/dist/es5/initJsDevMode.js +8 -0
  117. package/dist/es5/initJsDevMode.js.map +1 -0
  118. package/dist/es5/jsDevMode.js +8 -8
  119. package/dist/es5/jsDevMode.js.map +1 -0
  120. package/dist/es5/normalizer/charMaps.js +20 -35
  121. package/dist/es5/normalizer/charMaps.js.map +1 -0
  122. package/dist/es5/normalizer/index.js +3 -3
  123. package/dist/es5/normalizer/index.js.map +1 -0
  124. package/dist/es5/normalizer/normalizer.js +14 -14
  125. package/dist/es5/normalizer/normalizer.js.map +1 -0
  126. package/dist/es5/paginator/paginator.js +232 -226
  127. package/dist/es5/paginator/paginator.js.map +1 -0
  128. package/dist/es5/types/dictionaries.js +2 -1
  129. package/dist/es5/types/dictionaries.js.map +1 -0
  130. package/dist/es5/types/enums.js +2 -0
  131. package/dist/es5/types/enums.js.map +1 -0
  132. package/dist/es5/types/functions.js +2 -0
  133. package/dist/es5/types/functions.js.map +1 -0
  134. package/dist/es5/types/index.js +5 -3
  135. package/dist/es5/types/index.js.map +1 -0
  136. package/dist/es5/types/valueNamePair.js +2 -1
  137. package/dist/es5/types/valueNamePair.js.map +1 -0
  138. package/dist/es5/utils/common.js +220 -232
  139. package/dist/es5/utils/common.js.map +1 -0
  140. package/dist/es5/utils/index.js +4 -4
  141. package/dist/es5/utils/index.js.map +1 -0
  142. package/dist/es5/utils/lang.js +79 -79
  143. package/dist/es5/utils/lang.js.map +1 -0
  144. package/dist/es5/utils/nameof.js +6 -6
  145. package/dist/es5/utils/nameof.js.map +1 -0
  146. package/dist/module/decorators/bindThis.decorator.js +28 -28
  147. package/dist/module/decorators/bindThis.decorator.js.map +1 -0
  148. package/dist/module/decorators/callOnce.decorator.js +33 -32
  149. package/dist/module/decorators/callOnce.decorator.js.map +1 -0
  150. package/dist/module/decorators/debounceCall.decorator.js +29 -30
  151. package/dist/module/decorators/debounceCall.decorator.js.map +1 -0
  152. package/dist/module/decorators/index.js +7 -16
  153. package/dist/module/decorators/index.js.map +1 -0
  154. package/dist/module/encoder/encoder.js +224 -235
  155. package/dist/module/encoder/encoder.js.map +1 -0
  156. package/dist/module/enums/index.js +5 -14
  157. package/dist/module/enums/index.js.map +1 -0
  158. package/dist/module/enums/orderByDirection.js +18 -18
  159. package/dist/module/enums/orderByDirection.js.map +1 -0
  160. package/dist/module/index.js +13 -37
  161. package/dist/module/index.js.map +1 -0
  162. package/dist/module/indexNode.js +5 -14
  163. package/dist/module/indexNode.js.map +1 -0
  164. package/dist/module/initJsDevMode.js +10 -0
  165. package/dist/module/initJsDevMode.js.map +1 -0
  166. package/dist/module/jsDevMode.js +12 -12
  167. package/dist/module/jsDevMode.js.map +1 -0
  168. package/dist/module/normalizer/charMaps.js +23 -31
  169. package/dist/module/normalizer/charMaps.js.map +1 -0
  170. package/dist/module/normalizer/index.js +6 -15
  171. package/dist/module/normalizer/index.js.map +1 -0
  172. package/dist/module/normalizer/normalizer.js +18 -18
  173. package/dist/module/normalizer/normalizer.js.map +1 -0
  174. package/dist/module/paginator/paginator.js +234 -228
  175. package/dist/module/paginator/paginator.js.map +1 -0
  176. package/dist/module/types/dictionaries.js +3 -3
  177. package/dist/module/types/dictionaries.js.map +1 -0
  178. package/dist/module/types/enums.js +3 -0
  179. package/dist/module/types/enums.js.map +1 -0
  180. package/dist/module/types/functions.js +3 -0
  181. package/dist/module/types/functions.js.map +1 -0
  182. package/dist/module/types/index.js +8 -15
  183. package/dist/module/types/index.js.map +1 -0
  184. package/dist/module/types/valueNamePair.js +3 -3
  185. package/dist/module/types/valueNamePair.js.map +1 -0
  186. package/dist/module/utils/common.js +232 -240
  187. package/dist/module/utils/common.js.map +1 -0
  188. package/dist/module/utils/index.js +7 -16
  189. package/dist/module/utils/index.js.map +1 -0
  190. package/dist/module/utils/lang.js +99 -99
  191. package/dist/module/utils/lang.js.map +1 -0
  192. package/dist/module/utils/nameof.js +10 -9
  193. package/dist/module/utils/nameof.js.map +1 -0
  194. package/package.json +45 -16
  195. package/src/decorators/bindThis.decorator.d.ts +5 -7
  196. package/src/decorators/bindThis.decorator.d.ts.map +1 -1
  197. package/src/decorators/callOnce.decorator.d.ts +5 -5
  198. package/src/decorators/callOnce.decorator.d.ts.map +1 -1
  199. package/src/decorators/debounceCall.decorator.d.ts +5 -5
  200. package/src/decorators/debounceCall.decorator.d.ts.map +1 -1
  201. package/src/decorators/index.d.ts +3 -3
  202. package/src/encoder/encoder.d.ts +45 -45
  203. package/src/encoder/encoder.d.ts.map +1 -1
  204. package/src/enums/index.d.ts +1 -1
  205. package/src/enums/orderByDirection.d.ts +13 -13
  206. package/src/index.d.ts +9 -17
  207. package/src/index.d.ts.map +1 -1
  208. package/src/indexNode.d.ts +1 -1
  209. package/src/initJsDevMode.d.ts +2 -0
  210. package/src/initJsDevMode.d.ts.map +1 -0
  211. package/src/jsDevMode.d.ts +8 -8
  212. package/src/jsDevMode.d.ts.map +1 -1
  213. package/src/normalizer/charMaps.d.ts +5 -9
  214. package/src/normalizer/charMaps.d.ts.map +1 -1
  215. package/src/normalizer/index.d.ts +2 -2
  216. package/src/normalizer/normalizer.d.ts +7 -6
  217. package/src/normalizer/normalizer.d.ts.map +1 -1
  218. package/src/paginator/paginator.d.ts +129 -129
  219. package/src/paginator/paginator.d.ts.map +1 -1
  220. package/src/types/dictionaries.d.ts +15 -6
  221. package/src/types/dictionaries.d.ts.map +1 -1
  222. package/src/types/enums.d.ts +7 -0
  223. package/src/types/enums.d.ts.map +1 -0
  224. package/src/types/functions.d.ts +14 -0
  225. package/src/types/functions.d.ts.map +1 -0
  226. package/src/types/index.d.ts +4 -2
  227. package/src/types/index.d.ts.map +1 -1
  228. package/src/types/valueNamePair.d.ts +13 -13
  229. package/src/utils/common.d.ts +181 -122
  230. package/src/utils/common.d.ts.map +1 -1
  231. package/src/utils/index.d.ts +3 -3
  232. package/src/utils/lang.d.ts +41 -41
  233. package/src/utils/lang.d.ts.map +1 -1
  234. package/src/utils/nameof.d.ts +5 -5
  235. package/src/utils/nameof.d.ts.map +1 -1
  236. package/version.bak +1 -1
  237. package/.jsbeautifyrc +0 -7
  238. package/appveyor.yml +0 -67
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IAErC,OAAO,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5C,CAAC;AAyED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,YAAuC,EAAE,GAAG,OAA0B;IAEzF,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc;IAErC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAC9B;QACI,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;KACtE;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB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AE,QAAQ,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAO,eAAuB,EAAE,OAAqD;IAExH,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU,EAAE,UAA4B,EAAE;IAElE,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE;SAChB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SAClB,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAE9B,EAAE,GAAG,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAE5B,OAAO,EAAE,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAoB;IAE5C,OAAO,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;AACpG,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAEzC,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;AAClE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAQ,QAAe;IAE/C,OAAO,QAA+B,CAAC;AAC3C,CAAC","sourcesContent":["import extendLib from 'extend';\r\n\r\nimport {isPresent} from './lang';\r\nimport {AsDictionary, Dictionary, Enum, StringDictionary, ValueNamePair} from '../types';\r\nimport {normalize} from '../normalizer';\r\n\r\n/**\r\n * Reverse current string and returns new reverse string\r\n * @param str - String to be reversed\r\n * @returns string Reverse string\r\n */\r\nexport function reverseString(str: string): string\r\n{\r\n return str.split('').reverse().join('');\r\n}\r\n\r\n/**\r\n * Extends target object with source\r\n * @param deep - Indication whether deep copy should be performed\r\n * @param target - Object that will extended\r\n * @param source - Object that will be used for extending\r\n */\r\nexport function extend<T, U>(deep: boolean, target: T, source: U): T & U;\r\n/**\r\n * Extends target object with source objects\r\n * @param deep - Indication whether deep copy should be performed\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V>(deep: boolean, target: T, source1: U, source2: V): T & U & V;\r\n/**\r\n * Extends target object with source objects\r\n * @param deep - Indication whether deep copy should be performed\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n * @param source3 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V, W>(deep: boolean, target: T, source1: U, source2: V, source3: W): T & U & V & W;\r\n/**\r\n * Extends target object with source objects\r\n * @param deep - Indication whether deep copy should be performed\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n * @param source3 - Object that will be used for extending\r\n * @param source4 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V, W, X>(deep: boolean, target: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X;\r\n/**\r\n * Extends target object with source\r\n * @param target - Object that will extended\r\n * @param source - Object that will be used for extending\r\n */\r\nexport function extend<T, U>(target: T, source: U): T & U;\r\n/**\r\n * Extends target object with source\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V>(target: T, source1: U, source2: V): T & U & V;\r\n/**\r\n * Extends target object with source\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n * @param source3 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;\r\n/**\r\n * Extends target object with source\r\n * @param target - Object that will extended\r\n * @param source1 - Object that will be used for extending\r\n * @param source2 - Object that will be used for extending\r\n * @param source3 - Object that will be used for extending\r\n * @param source4 - Object that will be used for extending\r\n */\r\nexport function extend<T, U, V, W, X>(target: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X;\r\n/**\r\n * Extends one object with additional properties from other objects, supports deep extend\r\n * @param deepOrObject - Object to be extended or indication that deep copy should be performed\r\n * @param objectN - Objects that will be used for extending, if deep is used first here is target object\r\n * @returns Object Extended object with properties from other objects\r\n */\r\nexport function extend<TResult>(deepOrObject: boolean | Dictionary<any>, ...objectN: Dictionary<any>[]): TResult;\r\n/**\r\n * Extends one object with additional properties from other objects, supports deep extend\r\n * @param deepOrObject - Object to be extended or indication that deep copy should be performed\r\n * @param objectN - Objects that will be used for extending, if deep is used first here is target object\r\n * @returns Object Extended object with properties from other objects\r\n */\r\nexport function extend(deepOrObject: boolean | Dictionary<any>, ...objectN: Dictionary<any>[]): Dictionary\r\n{\r\n return extendLib.apply(null, [deepOrObject, ...objectN]);\r\n}\r\n\r\n/**\r\n * Generates random string consisting from lowercase letters\r\n * @param length - Length of generated string\r\n * @returns number Generated string\r\n */\r\nexport function generateId(length: number): string\r\n{\r\n let result = '';\r\n\r\n for(let x = 0; x < length; x++)\r\n {\r\n result += String.fromCharCode(Math.round(Math.random() * 25 + 97));\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Generates random string of specified length from possible characters\r\n * @param length - Length of generated string\r\n * @param possible - Possible characters used for generation of string\r\n */\r\nexport function generateRandomString(length: number, possible: string = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'): string\r\n{\r\n let text = '';\r\n\r\n for (let i = 0;i < length; i++)\r\n {\r\n text += possible.charAt(Math.floor(Math.random() * possible.length));\r\n }\r\n\r\n return text;\r\n}\r\n\r\n/**\r\n * Converts string in that way that first letter will be lowerCase\r\n * @param text - Text to be converted\r\n */\r\nexport function firstToLowerCase(text: string): string\r\n{\r\n return text.charAt(0).toLowerCase() + text.substr(1);\r\n}\r\n\r\n/**\r\n * Gets indication whether is child descendand of parent\r\n * @param parent - Parent to be tested\r\n * @param child - Child to be looked for\r\n */\r\nexport function isDescendant(parent: HTMLElement, child: HTMLElement): boolean\r\n{\r\n let node = child.parentNode;\r\n\r\n while (node != null)\r\n {\r\n if (node == parent)\r\n {\r\n return true;\r\n }\r\n\r\n node = node.parentNode;\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Computes offset of element against document\r\n * @param element - Html element which offset is counted\r\n * @param doc - Html document to be used for extracting scroll offset\r\n */\r\nexport function offset(element: HTMLElement, doc?: Document)\r\n{\r\n doc = doc || document;\r\n\r\n const rect = element.getBoundingClientRect(),\r\n scrollLeft = window.pageXOffset || doc.documentElement.scrollLeft,\r\n scrollTop = window.pageYOffset || doc.documentElement.scrollTop;\r\n\r\n return {\r\n top: rect.top + scrollTop,\r\n left: rect.left + scrollLeft,\r\n bottom: rect.top + scrollTop + rect.height,\r\n right: rect.left + scrollLeft + rect.width\r\n };\r\n}\r\n\r\n/**\r\n * Converts html string into html DOM\r\n * @param html - Html string to be converted to DOM\r\n * @param doc - Optional html document to be used\r\n */\r\nexport function htmlToElement(html: string, doc?: Document): HTMLElement\r\n{\r\n let htmlDocument = document;\r\n\r\n if(isPresent(doc))\r\n {\r\n htmlDocument = doc;\r\n }\r\n\r\n const template = htmlDocument.createElement('template');\r\n html = html.trim();\r\n template.innerHTML = html;\r\n\r\n return template.content.firstChild as HTMLElement;\r\n}\r\n\r\n/**\r\n * Extract values from enum type\r\n * @param enumType - Enum type that will have extracted values\r\n */\r\nexport function getEnumValues<TEnum extends Enum>(enumType: TEnum): ValueNamePair[]\r\n{\r\n const result: ValueNamePair[] = [];\r\n\r\n Object.keys(enumType).forEach(key =>\r\n {\r\n if(isNaN(+key))\r\n {\r\n return;\r\n }\r\n\r\n result.push(\r\n {\r\n value: key,\r\n name: enumType[+key]\r\n });\r\n });\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Safely returns value from object property using string expression\r\n * @param object - Object which property value will be obtained\r\n * @param expression - Expression for obtaining value\r\n */\r\nexport function getValue<TValue = unknown>(object: Dictionary<any>, expression: string): TValue\r\nexport function getValue(object: Dictionary<any>, expression: string): unknown\r\n{\r\n return expression.split('.').reduce((o, i) =>\r\n {\r\n if(o)\r\n {\r\n return o[i];\r\n }\r\n\r\n return null;\r\n }, object);\r\n}\r\n\r\n/**\r\n * Sets value to objects property using string expression\r\n * @param object - Object which property value will be set\r\n * @param value - Value that will be set\r\n * @param expression - Expression for setting value\r\n */\r\nexport function setValue(object: Dictionary<any>, value: unknown, expression: string): void\r\n{\r\n const parts = expression.split('.');\r\n\r\n parts.forEach((part, index) =>\r\n {\r\n //last item value is assigned\r\n if(index == parts.length - 1)\r\n {\r\n if(isPresent(value))\r\n {\r\n object[part] = value;\r\n }\r\n\r\n return;\r\n }\r\n\r\n object = object[part] = object[part] ?? {};\r\n });\r\n}\r\n\r\n/**\r\n * Formats string using '%s', to print '%s' you have to use '%%s'\r\n * @param str - String containing substitution constants\r\n * @param args - Arguments that are used for replacement\r\n */\r\nexport function format(str: string, ...args: unknown[]): string\r\n{\r\n let i = 0;\r\n\r\n return str.replace(/((?!%).)%s/g, (_sub, substArgs) => `${substArgs[0]}${args[i++]}`).replace(/%%s/g, '%s');\r\n}\r\n\r\n/**\r\n * Performs flatMap over provided array\r\n * @param array - Array to be reduced using flatMap\r\n */\r\nexport function flatMapArray<TItem>(array: TItem[][]): TItem[]\r\n{\r\n return array.reduce((acc, x) => acc.concat(x), []);\r\n}\r\n\r\n/**\r\n * Serialize object to string that is usable as url query parameter\r\n * @param obj - Object to be serialized\r\n * @param replacer - Function that can be used for replacing provided values\r\n */\r\nexport function serializeToUrlQuery<TObj>(obj: TObj, replacer?: (this: any, key: string, value: any) => any): string\r\n{\r\n return btoa(encodeURIComponent(JSON.stringify(obj, replacer)));\r\n}\r\n\r\n/**\r\n * Deserialize value from url query string into object\r\n * @param queryParamValue - Query param string value\r\n * @param reviver - Function that can be used for correctly deserializing value\r\n */\r\nexport function deserializeFromUrlQuery<TObj>(queryParamValue: string, reviver?: (this: any, key: string, value: any) => any): TObj\r\n{\r\n return JSON.parse(decodeURIComponent(atob(queryParamValue)), reviver);\r\n}\r\n\r\n/**\r\n * Converts id to valid html id\r\n * @param id - Id that is going to be converted to valid html id\r\n * @param charMap - Character map used during normalization\r\n */\r\nexport function validHtmlId(id: string, charMap: StringDictionary = {}): string\r\n{\r\n id = id.toLowerCase()\r\n .replace(/[\\s]+/g, '-')\r\n .replace(/\\./g, '')\r\n .replace(/^(\\d)/g, 'x$1');\r\n\r\n id = normalize(id, charMap);\r\n\r\n return id;\r\n}\r\n\r\n/**\r\n * Checks whether is element overflown either horizontal, or vertical\r\n * @param element - Element to be tested for overflow\r\n */\r\nexport function isOverflown(element: HTMLElement): boolean\r\n{\r\n return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;\r\n}\r\n\r\n/**\r\n * Normalizes string, removing accent\r\n * @param value - String to be normalized\r\n */\r\nexport function normalizeAccent(value: string): string\r\n{\r\n return value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '');\r\n}\r\n\r\n/**\r\n * Converts instance of Class to equivalent Record type\r\n * @param instance - Instance which type to be converted\r\n * @typeparam TType - Type of instance\r\n */\r\nexport function asDictionary<TType>(instance: TType): AsDictionary<TType>\r\n{\r\n return instance as AsDictionary<TType>;\r\n}\r\n"]}
@@ -0,0 +1,4 @@
1
+ export * from './common';
2
+ export * from './lang';
3
+ export * from './nameof';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC","sourcesContent":["export * from './common';\r\nexport * from './lang';\r\nexport * from './nameof';"]}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Tests whether is object not `null` and not `undefined` at the same time
3
+ * @param obj - Object to be tested
4
+ */
5
+ export function isPresent(obj) {
6
+ return obj !== undefined && obj !== null;
7
+ }
8
+ /**
9
+ * Tests whether is object `null` or `undefined`
10
+ * @param obj - Object to be tested
11
+ */
12
+ export function isBlank(obj) {
13
+ return obj === undefined || obj === null;
14
+ }
15
+ /**
16
+ * Tests whether is object instance of `boolean`
17
+ * @param obj - Object to be tested
18
+ */
19
+ export function isBoolean(obj) {
20
+ return typeof obj === 'boolean';
21
+ }
22
+ /**
23
+ * Tests whether is object instance of number
24
+ * @param obj - Object to be tested
25
+ */
26
+ export function isNumber(obj) {
27
+ return typeof obj === 'number';
28
+ }
29
+ /**
30
+ * Tests whether is object instance of string
31
+ * @param obj - Object to be tested
32
+ */
33
+ export function isString(obj) {
34
+ return typeof obj === 'string';
35
+ }
36
+ /**
37
+ * Tests whether is object instance of function
38
+ * @param obj - Object to be tested
39
+ */
40
+ export function isFunction(obj) {
41
+ return typeof obj === 'function';
42
+ }
43
+ export function isType(obj) {
44
+ return isFunction(obj);
45
+ }
46
+ export function isStringMap(obj) {
47
+ return typeof obj === 'object' && obj !== null;
48
+ }
49
+ const STRING_MAP_PROTO = Object.getPrototypeOf({});
50
+ export function isStrictStringMap(obj) {
51
+ return isStringMap(obj) && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
52
+ }
53
+ export function isArray(obj) {
54
+ return Array.isArray(obj);
55
+ }
56
+ export function isDate(obj) {
57
+ return obj instanceof Date && !isNaN(obj.valueOf());
58
+ }
59
+ export function noop() {
60
+ }
61
+ export function normalizeBlank(obj) {
62
+ return isBlank(obj) ? null : obj;
63
+ }
64
+ export function isJsObject(o) {
65
+ return o !== null && (typeof o === 'function' || typeof o === 'object');
66
+ }
67
+ export function isPrimitive(obj) {
68
+ return !isJsObject(obj);
69
+ }
70
+ export function hasConstructor(value, type) {
71
+ return value.constructor === type;
72
+ }
73
+ export function isEmptyObject(obj) {
74
+ for (const _name in obj) {
75
+ return false;
76
+ }
77
+ return true;
78
+ }
79
+ //# sourceMappingURL=lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang.js","sourceRoot":"","sources":["../../../src/utils/lang.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAO,GAAS;IAErC,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,GAAQ;IAE5B,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,GAAQ;IAE9B,OAAO,OAAO,GAAG,KAAK,SAAS,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAQ;IAE7B,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAQ;IAE7B,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAQ;IAE/B,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAQ;IAE3B,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAQ;IAEhC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,CAAC;AACnD,CAAC;AAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;AAEnD,MAAM,UAAU,iBAAiB,CAAC,GAAQ;IAEtC,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,gBAAgB,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,GAAQ;IAE5B,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAQ;IAE3B,OAAO,GAAG,YAAY,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,IAAI;AAGpB,CAAC;AAED,MAAM,UAAU,cAAc,CAAsB,GAAwB;IAExE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAM;IAE7B,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,UAAU,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAQ;IAEhC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,IAAS;IAEnD,OAAO,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAQ;IAElC,KAAK,MAAM,KAAK,IAAI,GAAG,EACvB;QACI,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["/**\r\n * Tests whether is object not `null` and not `undefined` at the same time\r\n * @param obj - Object to be tested\r\n */\r\nexport function isPresent<TObj>(obj: TObj): obj is NonNullable<TObj>\r\n{\r\n return obj !== undefined && obj !== null;\r\n}\r\n\r\n/**\r\n * Tests whether is object `null` or `undefined`\r\n * @param obj - Object to be tested\r\n */\r\nexport function isBlank(obj: any): obj is null|undefined\r\n{\r\n return obj === undefined || obj === null;\r\n}\r\n\r\n/**\r\n * Tests whether is object instance of `boolean`\r\n * @param obj - Object to be tested\r\n */\r\nexport function isBoolean(obj: any): obj is boolean\r\n{\r\n return typeof obj === 'boolean';\r\n}\r\n\r\n/**\r\n * Tests whether is object instance of number\r\n * @param obj - Object to be tested\r\n */\r\nexport function isNumber(obj: any): obj is number\r\n{\r\n return typeof obj === 'number';\r\n}\r\n\r\n/**\r\n * Tests whether is object instance of string\r\n * @param obj - Object to be tested\r\n */\r\nexport function isString(obj: any): obj is string\r\n{\r\n return typeof obj === 'string';\r\n}\r\n\r\n/**\r\n * Tests whether is object instance of function\r\n * @param obj - Object to be tested\r\n */\r\nexport function isFunction(obj: any): obj is Function\r\n{\r\n return typeof obj === 'function';\r\n}\r\n\r\nexport function isType(obj: any): obj is Function\r\n{\r\n return isFunction(obj);\r\n}\r\n\r\nexport function isStringMap(obj: any): obj is Object\r\n{\r\n return typeof obj === 'object' && obj !== null;\r\n}\r\n\r\nconst STRING_MAP_PROTO = Object.getPrototypeOf({});\r\n\r\nexport function isStrictStringMap(obj: any): boolean\r\n{\r\n return isStringMap(obj) && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;\r\n}\r\n\r\nexport function isArray(obj: any): obj is Array<any>\r\n{\r\n return Array.isArray(obj);\r\n}\r\n\r\nexport function isDate(obj: any): obj is Date\r\n{\r\n return obj instanceof Date && !isNaN(obj.valueOf());\r\n}\r\n\r\nexport function noop(): void\r\n// eslint-disable-next-line @typescript-eslint/no-empty-function\r\n{\r\n}\r\n\r\nexport function normalizeBlank<TObj extends Object>(obj: TObj|undefined|null): TObj|null\r\n{\r\n return isBlank(obj) ? null : obj;\r\n}\r\n\r\nexport function isJsObject(o: any): o is Function|Object\r\n{\r\n return o !== null && (typeof o === 'function' || typeof o === 'object');\r\n}\r\n\r\nexport function isPrimitive(obj: any): boolean\r\n{\r\n return !isJsObject(obj);\r\n}\r\n\r\nexport function hasConstructor(value: Object, type: any): boolean\r\n{\r\n return value.constructor === type;\r\n}\r\n\r\nexport function isEmptyObject(obj: any): boolean\r\n{\r\n for (const _name in obj)\r\n {\r\n return false;\r\n }\r\n\r\n return true;\r\n}"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns name of property, checked by typescript
3
+ * @param name - Name of property that should be returned
4
+ */
5
+ export const nameof = (name) => name;
6
+ //# sourceMappingURL=nameof.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nameof.js","sourceRoot":"","sources":["../../../src/utils/nameof.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,IAA8B,EAAU,EAAE,CAAC,IAAI,CAAC","sourcesContent":["/**\r\n * Returns name of property, checked by typescript\r\n * @param name - Name of property that should be returned\r\n */\r\nexport const nameof = <T>(name: Extract<keyof T, string>): string => name;"]}
@@ -1,24 +1,24 @@
1
- import { isFunction } from '../utils';
2
- /**
3
- * Binds function to this, object instance where is defined, it is importat to place it in correct order with other decorators, usually should be first
4
- */
5
- export function BindThis(_target, propertyKey, descriptor) {
6
- var _a;
7
- var originalValue = (_a = descriptor.value) !== null && _a !== void 0 ? _a : descriptor.get();
8
- if (!isFunction(originalValue)) {
9
- throw new Error("Unable to apply @BindThis decorator to '" + propertyKey + "', it is not a method.");
10
- }
11
- return {
12
- configurable: true,
13
- get: function () {
14
- var bound = originalValue.bind(this);
15
- Object.defineProperty(this, propertyKey, {
16
- value: bound,
17
- configurable: true,
18
- writable: true
19
- });
20
- return bound;
21
- }
22
- };
23
- }
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmluZFRoaXMuZGVjb3JhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2RlY29yYXRvcnMvYmluZFRoaXMuZGVjb3JhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxVQUFV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oX3RhcmdldDogT2JqZWN0LCBwcm9wZXJ0eUtleTogc3RyaW5nLCBkZXNjcmlwdG9yOiBQcm9wZXJ0eURlc2NyaXB0b3IpXHJcbntcclxuICAgIGxldCBvcmlnaW5hbFZhbHVlOiBGdW5jdGlvbiA9IGRlc2NyaXB0b3IudmFsdWUgPz8gZGVzY3JpcHRvci5nZXQoKTtcclxuXHJcbiAgICBpZighaXNGdW5jdGlvbihvcmlnaW5hbFZhbHVlKSlcclxuICAgIHtcclxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYFVuYWJsZSB0byBhcHBseSBAQmluZFRoaXMgZGVjb3JhdG9yIHRvICcke3Byb3BlcnR5S2V5fScsIGl0IGlzIG5vdCBhIG1ldGhvZC5gKTtcclxuICAgIH1cclxuXHJcbiAgICByZXR1cm4ge1xyXG4gICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcclxuICAgICAgICBnZXQodGhpczogYW55KTogYW55XHJcbiAgICAgICAge1xyXG4gICAgICAgICAgICBjb25zdCBib3VuZDogYW55ID0gb3JpZ2luYWxWYWx1ZS5iaW5kKHRoaXMpO1xyXG5cclxuICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eUtleSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogYm91bmQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRhYmxlOiB0cnVlXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcclxuXHJcbiAgICAgICAgICAgIHJldHVybiBib3VuZDtcclxuICAgICAgICB9XHJcbiAgICB9O1xyXG59Il19
1
+ import { isFunction } from '../utils';
2
+ /**
3
+ * Binds function to this, object instance where is defined, it is importat to place it in correct order with other decorators, usually should be first
4
+ */
5
+ export function BindThis(_target, propertyKey, descriptor) {
6
+ var _a, _b;
7
+ var originalValue = (_a = descriptor.value) !== null && _a !== void 0 ? _a : (_b = descriptor.get) === null || _b === void 0 ? void 0 : _b.call(descriptor);
8
+ if (!isFunction(originalValue)) {
9
+ throw new Error("Unable to apply @BindThis decorator to '" + propertyKey.toString() + "', it is not a method.");
10
+ }
11
+ return {
12
+ configurable: true,
13
+ get: function () {
14
+ var bound = originalValue.bind(this);
15
+ Object.defineProperty(this, propertyKey, {
16
+ value: bound,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ return bound;
21
+ }
22
+ };
23
+ }
24
+ //# sourceMappingURL=bindThis.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindThis.decorator.js","sourceRoot":"","sources":["../../../src/decorators/bindThis.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE,WAA0B,EAAE,UAA8B;;IAEhG,IAAM,aAAa,GAAS,MAAA,UAAU,CAAC,KAAK,mCAAI,MAAA,UAAU,CAAC,GAAG,+CAAd,UAAU,CAAQ,CAAC;IAEnE,IAAG,CAAC,UAAU,CAAC,aAAa,CAAC,EAC7B;QACI,MAAM,IAAI,KAAK,CAAC,6CAA2C,WAAW,CAAC,QAAQ,EAAE,2BAAwB,CAAC,CAAC;KAC9G;IAED,OAAO;QACH,YAAY,EAAE,IAAI;QAClB,GAAG,EAAH;YAEI,IAAM,KAAK,GAAS,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE7C,MAAM,CAAC,cAAc,CAAC,IAAI,EACJ,WAAW,EACX;gBACI,KAAK,EAAE,KAAK;gBACZ,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACjB,CAAC,CAAC;YAEzB,OAAO,KAAK,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC","sourcesContent":["import {Func} from '../types';\r\nimport {isFunction} from '../utils';\r\n\r\n/**\r\n * Binds function to this, object instance where is defined, it is importat to place it in correct order with other decorators, usually should be first\r\n */\r\nexport function BindThis(_target: Object, propertyKey: string|symbol, descriptor: PropertyDescriptor): TypedPropertyDescriptor<Func>\r\n{\r\n const originalValue: Func = descriptor.value ?? descriptor.get?.();\r\n\r\n if(!isFunction(originalValue))\r\n {\r\n throw new Error(`Unable to apply @BindThis decorator to '${propertyKey.toString()}', it is not a method.`);\r\n }\r\n\r\n return {\r\n configurable: true,\r\n get(this: unknown): Func\r\n {\r\n const bound: Func = originalValue.bind(this);\r\n\r\n Object.defineProperty(this,\r\n propertyKey,\r\n {\r\n value: bound,\r\n configurable: true,\r\n writable: true\r\n });\r\n\r\n return bound;\r\n }\r\n };\r\n}"]}
@@ -1,28 +1,33 @@
1
- import { isFunction, isPresent } from '../utils';
2
- /**
3
- * Method is called only once for specified time, other calls during this time are blocked and it does nothing and returns null
4
- * @param time - Number of miliseconds which specifies period while are calls to this method blocked after first call
5
- */
6
- export function CallOnce(time) {
7
- return function (_target, propertyKey, descriptor) {
8
- var _a;
9
- var timeout;
10
- var originalValue = (_a = descriptor.value) !== null && _a !== void 0 ? _a : descriptor.get();
11
- if (!isFunction(originalValue)) {
12
- throw new Error("Unable to apply @CallOnce() decorator to '" + propertyKey + "', it is not a method.");
13
- }
14
- descriptor.value = function () {
15
- var args = arguments;
16
- if (isPresent(timeout)) {
17
- return null;
18
- }
19
- originalValue.apply(this, args);
20
- timeout = setTimeout(function () {
21
- clearTimeout(timeout);
22
- timeout = null;
23
- }, time);
24
- };
25
- return descriptor;
26
- };
27
- }
28
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FsbE9uY2UuZGVjb3JhdG9yLmpzIiwic291cmN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GZ1bmN0aW9uKClcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIGxldCBhcmdzID0gYXJndW1lbnRzO1xyXG5cclxuICAgICAgICAgICAgaWYoaXNQcmVzZW50KHRpbWVvdXQpKVxyXG4gICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgb3JpZ2luYWxWYWx1ZS5hcHBseSh0aGlzLCBhcmdzKTtcclxuXHJcbiAgICAgICAgICAgIHRpbWVvdXQgPSBzZXRUaW1lb3V0KCgpID0+XHJcbiAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aW1lb3V0KTtcclxuICAgICAgICAgICAgICAgIHRpbWVvdXQgPSBudWxsO1xyXG4gICAgICAgICAgICB9LCB0aW1lKSBhcyBhbnk7XHJcbiAgICAgICAgfTtcclxuXHJcbiAgICAgICAgcmV0dXJuIGRlc2NyaXB0b3I7XHJcbiAgICB9O1xyXG59Il19
1
+ import { isFunction, isPresent } from '../utils';
2
+ /**
3
+ * Method is called only once for specified time, other calls during this time are blocked and it does nothing and returns null
4
+ * @param time - Number of miliseconds which specifies period while are calls to this method blocked after first call
5
+ */
6
+ export function CallOnce(time) {
7
+ return function (_target, propertyKey, descriptor) {
8
+ var _a, _b;
9
+ var timeout;
10
+ var originalValue = (_a = descriptor.value) !== null && _a !== void 0 ? _a : (_b = descriptor.get) === null || _b === void 0 ? void 0 : _b.call(descriptor);
11
+ if (!isFunction(originalValue)) {
12
+ throw new Error("Unable to apply @CallOnce() decorator to '" + propertyKey.toString() + "', it is not a method.");
13
+ }
14
+ descriptor.value = function () {
15
+ var args = [];
16
+ for (var _i = 0; _i < arguments.length; _i++) {
17
+ args[_i] = arguments[_i];
18
+ }
19
+ if (isPresent(timeout)) {
20
+ return;
21
+ }
22
+ originalValue.apply(this, args);
23
+ timeout = setTimeout(function () {
24
+ if (isPresent(timeout)) {
25
+ clearTimeout(timeout);
26
+ }
27
+ timeout = null;
28
+ }, time);
29
+ };
30
+ return descriptor;
31
+ };
32
+ }
33
+ //# sourceMappingURL=callOnce.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callOnce.decorator.js","sourceRoot":"","sources":["../../../src/decorators/callOnce.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IAEjC,OAAO,UAAS,OAAe,EAAE,WAA0B,EAAE,UAA8B;;QAEvF,IAAI,OAAoB,CAAC;QACzB,IAAM,aAAa,GAAS,MAAA,UAAU,CAAC,KAAK,mCAAI,MAAA,UAAU,CAAC,GAAG,+CAAd,UAAU,CAAQ,CAAC;QAEnE,IAAG,CAAC,UAAU,CAAC,aAAa,CAAC,EAC7B;YACI,MAAM,IAAI,KAAK,CAAC,+CAA6C,WAAW,CAAC,QAAQ,EAAE,2BAAwB,CAAC,CAAC;SAChH;QAED,UAAU,CAAC,KAAK,GAAG;YAAS,cAAkB;iBAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;gBAAlB,yBAAkB;;YAE1C,IAAG,SAAS,CAAC,OAAO,CAAC,EACrB;gBACI,OAAO;aACV;YAED,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAEhC,OAAO,GAAG,UAAU,CAAC;gBAEjB,IAAG,SAAS,CAAC,OAAO,CAAC,EACrB;oBACI,YAAY,CAAC,OAAO,CAAC,CAAC;iBACzB;gBAED,OAAO,GAAG,IAAI,CAAC;YACnB,CAAC,EAAE,IAAI,CAAQ,CAAC;QACpB,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC","sourcesContent":["import {Func} from '../types';\r\nimport {isFunction, isPresent} from '../utils';\r\n\r\n/**\r\n * Method is called only once for specified time, other calls during this time are blocked and it does nothing and returns null\r\n * @param time - Number of miliseconds which specifies period while are calls to this method blocked after first call\r\n */\r\nexport function CallOnce(time: number): MethodDecorator\r\n{\r\n return function(_target: Object, propertyKey: string|symbol, descriptor: PropertyDescriptor)\r\n {\r\n let timeout: number|null;\r\n const originalValue: Func = descriptor.value ?? descriptor.get?.();\r\n\r\n if(!isFunction(originalValue))\r\n {\r\n throw new Error(`Unable to apply @CallOnce() decorator to '${propertyKey.toString()}', it is not a method.`);\r\n }\r\n\r\n descriptor.value = function(...args: unknown[]): void\r\n {\r\n if(isPresent(timeout))\r\n {\r\n return;\r\n }\r\n\r\n originalValue.apply(this, args);\r\n\r\n timeout = setTimeout(() =>\r\n {\r\n if(isPresent(timeout))\r\n {\r\n clearTimeout(timeout);\r\n }\r\n \r\n timeout = null;\r\n }, time) as any;\r\n };\r\n\r\n return descriptor;\r\n };\r\n}"]}
@@ -1,27 +1,30 @@
1
- import { isFunction, isPresent } from '../utils';
2
- /**
3
- * Adds special functionality to method call, that debounce method call for specified time
4
- * @param delay - Number of miliseconds that delays function call
5
- */
6
- export function DebounceCall(delay) {
7
- return function (_target, propertyKey, descriptor) {
8
- var _a;
9
- var timeout;
10
- var originalValue = (_a = descriptor.value) !== null && _a !== void 0 ? _a : descriptor.get();
11
- if (!isFunction(originalValue)) {
12
- throw new Error("Unable to apply @DebounceCall() decorator to '" + propertyKey + "', it is not a method.");
13
- }
14
- descriptor.value = function () {
15
- var _this = this;
16
- var args = arguments;
17
- if (isPresent(timeout)) {
18
- clearTimeout(timeout);
19
- }
20
- timeout = setTimeout(function () {
21
- originalValue.apply(_this, args);
22
- }, delay);
23
- };
24
- return descriptor;
25
- };
26
- }
27
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVib3VuY2VDYWxsLmRlY29yYXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9kZWNvcmF0b3JzL2RlYm91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gICAgICB9XHJcblxyXG4gICAgICAgICAgICB0aW1lb3V0ID0gc2V0VGltZW91dCgoKSA9PlxyXG4gICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICBvcmlnaW5hbFZhbHVlLmFwcGx5KHRoaXMsIGFyZ3MpO1xyXG4gICAgICAgICAgICB9LCBkZWxheSkgYXMgYW55O1xyXG4gICAgICAgIH07XHJcblxyXG4gICAgICAgIHJldHVybiBkZXNjcmlwdG9yO1xyXG4gICAgfTtcclxufSJdfQ==
1
+ import { isFunction, isPresent } from '../utils';
2
+ /**
3
+ * Adds special functionality to method call, that debounce method call for specified time
4
+ * @param delay - Number of miliseconds that delays function call
5
+ */
6
+ export function DebounceCall(delay) {
7
+ return function (_target, propertyKey, descriptor) {
8
+ var _a, _b;
9
+ var timeout;
10
+ var originalValue = (_a = descriptor.value) !== null && _a !== void 0 ? _a : (_b = descriptor.get) === null || _b === void 0 ? void 0 : _b.call(descriptor);
11
+ if (!isFunction(originalValue)) {
12
+ throw new Error("Unable to apply @DebounceCall() decorator to '" + propertyKey.toString() + "', it is not a method.");
13
+ }
14
+ descriptor.value = function () {
15
+ var _this = this;
16
+ var args = [];
17
+ for (var _i = 0; _i < arguments.length; _i++) {
18
+ args[_i] = arguments[_i];
19
+ }
20
+ if (isPresent(timeout)) {
21
+ clearTimeout(timeout);
22
+ }
23
+ timeout = setTimeout(function () {
24
+ originalValue.apply(_this, args);
25
+ }, delay);
26
+ };
27
+ return descriptor;
28
+ };
29
+ }
30
+ //# sourceMappingURL=debounceCall.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounceCall.decorator.js","sourceRoot":"","sources":["../../../src/decorators/debounceCall.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IAEtC,OAAO,UAAS,OAAe,EAAE,WAA0B,EAAE,UAA8B;;QAEvF,IAAI,OAAe,CAAC;QACpB,IAAM,aAAa,GAAS,MAAA,UAAU,CAAC,KAAK,mCAAI,MAAA,UAAU,CAAC,GAAG,+CAAd,UAAU,CAAQ,CAAC;QAEnE,IAAG,CAAC,UAAU,CAAC,aAAa,CAAC,EAC7B;YACI,MAAM,IAAI,KAAK,CAAC,mDAAiD,WAAW,CAAC,QAAQ,EAAE,2BAAwB,CAAC,CAAC;SACpH;QAED,UAAU,CAAC,KAAK,GAAG;YAAA,iBAWlB;YAX2B,cAAkB;iBAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;gBAAlB,yBAAkB;;YAE1C,IAAG,SAAS,CAAC,OAAO,CAAC,EACrB;gBACI,YAAY,CAAC,OAAO,CAAC,CAAC;aACzB;YAED,OAAO,GAAG,UAAU,CAAC;gBAEjB,aAAa,CAAC,KAAK,CAAC,KAAI,EAAE,IAAI,CAAC,CAAC;YACpC,CAAC,EAAE,KAAK,CAAQ,CAAC;QACrB,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC","sourcesContent":["import {Func} from '../types';\r\nimport {isFunction, isPresent} from '../utils';\r\n\r\n/**\r\n * Adds special functionality to method call, that debounce method call for specified time\r\n * @param delay - Number of miliseconds that delays function call\r\n */\r\nexport function DebounceCall(delay: number): MethodDecorator\r\n{\r\n return function(_target: Object, propertyKey: string|symbol, descriptor: PropertyDescriptor)\r\n {\r\n let timeout: number;\r\n const originalValue: Func = descriptor.value ?? descriptor.get?.();\r\n\r\n if(!isFunction(originalValue))\r\n {\r\n throw new Error(`Unable to apply @DebounceCall() decorator to '${propertyKey.toString()}', it is not a method.`);\r\n }\r\n\r\n descriptor.value = function(...args: unknown[]): void\r\n {\r\n if(isPresent(timeout))\r\n {\r\n clearTimeout(timeout);\r\n }\r\n\r\n timeout = setTimeout(() =>\r\n {\r\n originalValue.apply(this, args);\r\n }, delay) as any;\r\n };\r\n\r\n return descriptor;\r\n };\r\n}"]}
@@ -1,4 +1,4 @@
1
- export * from './bindThis.decorator';
2
- export * from './callOnce.decorator';
3
- export * from './debounceCall.decorator';
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZGVjb3JhdG9ycy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNCQUFzQixDQUFDO0FBQ3JDLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsY0FBYywwQkFBMEIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vYmluZFRoaXMuZGVjb3JhdG9yJztcclxuZXhwb3J0ICogZnJvbSAnLi9jYWxsT25jZS5kZWNvcmF0b3InO1xyXG5leHBvcnQgKiBmcm9tICcuL2RlYm91bmNlQ2FsbC5kZWNvcmF0b3InOyJdfQ==
1
+ export * from './bindThis.decorator';
2
+ export * from './callOnce.decorator';
3
+ export * from './debounceCall.decorator';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './bindThis.decorator';\r\nexport * from './callOnce.decorator';\r\nexport * from './debounceCall.decorator';"]}