@ezez/utils 1.0.0 → 1.2.0

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 (159) hide show
  1. package/CHANGELOG.md +24 -8
  2. package/README.md +41 -18
  3. package/dist/ensureDate.d.ts +3 -0
  4. package/dist/ensureDate.d.ts.map +1 -0
  5. package/dist/ensureDate.js +11 -0
  6. package/dist/ensureDate.js.map +1 -0
  7. package/dist/ensurePrefix.d.ts +3 -0
  8. package/dist/ensurePrefix.d.ts.map +1 -0
  9. package/dist/ensurePrefix.js +11 -0
  10. package/dist/ensurePrefix.js.map +1 -0
  11. package/dist/ensureSuffix.d.ts +3 -0
  12. package/dist/ensureSuffix.d.ts.map +1 -0
  13. package/dist/ensureSuffix.js +11 -0
  14. package/dist/ensureSuffix.js.map +1 -0
  15. package/dist/ensureTimestamp.d.ts +3 -0
  16. package/dist/ensureTimestamp.d.ts.map +1 -0
  17. package/dist/ensureTimestamp.js +11 -0
  18. package/dist/ensureTimestamp.js.map +1 -0
  19. package/dist/index.d.ts +8 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +8 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/isEmpty.js +1 -1
  24. package/dist/isEmpty.js.map +1 -1
  25. package/dist/isNumericString.d.ts +10 -0
  26. package/dist/isNumericString.d.ts.map +1 -0
  27. package/dist/isNumericString.js +61 -0
  28. package/dist/isNumericString.js.map +1 -0
  29. package/dist/occurrences.d.ts +7 -0
  30. package/dist/occurrences.d.ts.map +1 -0
  31. package/dist/occurrences.js +27 -0
  32. package/dist/occurrences.js.map +1 -0
  33. package/dist/stripPrefix.d.ts +3 -0
  34. package/dist/stripPrefix.d.ts.map +1 -0
  35. package/dist/stripPrefix.js +11 -0
  36. package/dist/stripPrefix.js.map +1 -0
  37. package/dist/stripSuffix.d.ts +3 -0
  38. package/dist/stripSuffix.d.ts.map +1 -0
  39. package/dist/stripSuffix.js +11 -0
  40. package/dist/stripSuffix.js.map +1 -0
  41. package/docs/assets/search.js +1 -1
  42. package/docs/functions/cap.html +15 -5
  43. package/docs/functions/capitalize.html +15 -5
  44. package/docs/functions/coalesce.html +15 -5
  45. package/docs/functions/ensureArray.html +15 -5
  46. package/docs/functions/ensureDate.html +126 -0
  47. package/docs/functions/ensureError.html +15 -5
  48. package/docs/functions/ensurePrefix.html +128 -0
  49. package/docs/functions/ensureSuffix.html +128 -0
  50. package/docs/functions/ensureTimestamp.html +126 -0
  51. package/docs/functions/get.html +15 -5
  52. package/docs/functions/getMultiple.html +15 -5
  53. package/docs/functions/insertSeparator.html +15 -5
  54. package/docs/functions/isEmpty.html +15 -5
  55. package/docs/functions/isNumericString.html +123 -0
  56. package/docs/functions/isPlainObject.html +15 -5
  57. package/docs/functions/last.html +15 -5
  58. package/docs/functions/mapAsync.html +15 -5
  59. package/docs/functions/mapValues.html +15 -5
  60. package/docs/functions/match.html +15 -5
  61. package/docs/functions/merge.html +23 -13
  62. package/docs/functions/mostFrequent.html +15 -5
  63. package/docs/functions/noop.html +15 -5
  64. package/docs/functions/occurrences.html +135 -0
  65. package/docs/functions/omit.html +15 -5
  66. package/docs/functions/pick.html +15 -5
  67. package/docs/functions/pull.html +15 -5
  68. package/docs/functions/remove.html +15 -5
  69. package/docs/functions/rethrow.html +15 -5
  70. package/docs/functions/scale.html +15 -5
  71. package/docs/functions/seq.html +15 -5
  72. package/docs/functions/seqEarlyBreak.html +15 -5
  73. package/docs/functions/set.html +15 -5
  74. package/docs/functions/setImmutable.html +15 -5
  75. package/docs/functions/sortBy.html +15 -5
  76. package/docs/functions/stripPrefix.html +122 -0
  77. package/docs/functions/stripSuffix.html +122 -0
  78. package/docs/functions/throttle.html +15 -5
  79. package/docs/functions/truthy.html +15 -5
  80. package/docs/functions/wait.html +15 -5
  81. package/docs/functions/waitFor.html +15 -5
  82. package/docs/functions/waitSync.html +15 -5
  83. package/docs/index.html +86 -22
  84. package/docs/interfaces/GetMultipleSource.html +15 -5
  85. package/docs/interfaces/GetSource.html +15 -5
  86. package/docs/interfaces/IsNumericStringOptions.html +90 -0
  87. package/docs/interfaces/OccurencesOptions.html +71 -0
  88. package/docs/interfaces/SetImmutableSource.html +15 -5
  89. package/docs/interfaces/SetSource.html +15 -5
  90. package/docs/interfaces/ThrottleOptions.html +7 -7
  91. package/docs/interfaces/ThrottledFunctionExtras.html +7 -7
  92. package/docs/modules.html +24 -4
  93. package/docs/pages/Introduction.html +14 -4
  94. package/docs/types/MapValuesFn.html +15 -5
  95. package/docs/types/MatchCallback.html +15 -5
  96. package/docs/types/SeqEarlyBreaker.html +15 -5
  97. package/docs/types/SeqFn.html +15 -5
  98. package/docs/types/SeqFunctions.html +15 -5
  99. package/docs/types/SetImmutablePath.html +15 -5
  100. package/docs/types/ThrottledFunction.html +15 -5
  101. package/docs/variables/mapValuesUNSET.html +15 -5
  102. package/docs/variables/mergeUNSET.html +15 -5
  103. package/esm/ensureDate.d.ts +3 -0
  104. package/esm/ensureDate.d.ts.map +1 -0
  105. package/esm/ensureDate.js +8 -0
  106. package/esm/ensureDate.js.map +1 -0
  107. package/esm/ensurePrefix.d.ts +3 -0
  108. package/esm/ensurePrefix.d.ts.map +1 -0
  109. package/esm/ensurePrefix.js +8 -0
  110. package/esm/ensurePrefix.js.map +1 -0
  111. package/esm/ensureSuffix.d.ts +3 -0
  112. package/esm/ensureSuffix.d.ts.map +1 -0
  113. package/esm/ensureSuffix.js +8 -0
  114. package/esm/ensureSuffix.js.map +1 -0
  115. package/esm/ensureTimestamp.d.ts +3 -0
  116. package/esm/ensureTimestamp.d.ts.map +1 -0
  117. package/esm/ensureTimestamp.js +8 -0
  118. package/esm/ensureTimestamp.js.map +1 -0
  119. package/esm/index.d.ts +8 -0
  120. package/esm/index.d.ts.map +1 -1
  121. package/esm/index.js +8 -0
  122. package/esm/index.js.map +1 -1
  123. package/esm/isEmpty.js +1 -1
  124. package/esm/isEmpty.js.map +1 -1
  125. package/esm/isNumericString.d.ts +10 -0
  126. package/esm/isNumericString.d.ts.map +1 -0
  127. package/esm/isNumericString.js +58 -0
  128. package/esm/isNumericString.js.map +1 -0
  129. package/esm/occurrences.d.ts +7 -0
  130. package/esm/occurrences.d.ts.map +1 -0
  131. package/esm/occurrences.js +24 -0
  132. package/esm/occurrences.js.map +1 -0
  133. package/esm/stripPrefix.d.ts +3 -0
  134. package/esm/stripPrefix.d.ts.map +1 -0
  135. package/esm/stripPrefix.js +8 -0
  136. package/esm/stripPrefix.js.map +1 -0
  137. package/esm/stripSuffix.d.ts +3 -0
  138. package/esm/stripSuffix.d.ts.map +1 -0
  139. package/esm/stripSuffix.js +8 -0
  140. package/esm/stripSuffix.js.map +1 -0
  141. package/package.json +1 -1
  142. package/src/ensureDate.spec.ts +13 -0
  143. package/src/ensureDate.ts +18 -0
  144. package/src/ensurePrefix.spec.ts +11 -0
  145. package/src/ensurePrefix.ts +18 -0
  146. package/src/ensureSuffix.spec.ts +11 -0
  147. package/src/ensureSuffix.ts +18 -0
  148. package/src/ensureTimestamp.spec.ts +11 -0
  149. package/src/ensureTimestamp.ts +18 -0
  150. package/src/index.ts +8 -0
  151. package/src/isEmpty.ts +1 -1
  152. package/src/isNumericString.spec.ts +100 -0
  153. package/src/isNumericString.ts +94 -0
  154. package/src/occurrences.spec.ts +20 -0
  155. package/src/occurrences.ts +53 -0
  156. package/src/stripPrefix.spec.ts +13 -0
  157. package/src/stripPrefix.ts +15 -0
  158. package/src/stripSuffix.spec.ts +13 -0
  159. package/src/stripSuffix.ts +16 -0
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Strip a suffix from a string.
3
+ *
4
+ * @param {string} from - string to strip suffix from
5
+ * @param {string} suffix - suffix to strip
6
+ */
7
+ const stripSuffix = (from: string, suffix: string): string => {
8
+ if (from.endsWith(suffix)) {
9
+ return from.slice(0, -suffix.length);
10
+ }
11
+ return from;
12
+ };
13
+
14
+ export {
15
+ stripSuffix,
16
+ };