@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.
- package/CHANGELOG.md +24 -8
- package/README.md +41 -18
- package/dist/ensureDate.d.ts +3 -0
- package/dist/ensureDate.d.ts.map +1 -0
- package/dist/ensureDate.js +11 -0
- package/dist/ensureDate.js.map +1 -0
- package/dist/ensurePrefix.d.ts +3 -0
- package/dist/ensurePrefix.d.ts.map +1 -0
- package/dist/ensurePrefix.js +11 -0
- package/dist/ensurePrefix.js.map +1 -0
- package/dist/ensureSuffix.d.ts +3 -0
- package/dist/ensureSuffix.d.ts.map +1 -0
- package/dist/ensureSuffix.js +11 -0
- package/dist/ensureSuffix.js.map +1 -0
- package/dist/ensureTimestamp.d.ts +3 -0
- package/dist/ensureTimestamp.d.ts.map +1 -0
- package/dist/ensureTimestamp.js +11 -0
- package/dist/ensureTimestamp.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/isEmpty.js +1 -1
- package/dist/isEmpty.js.map +1 -1
- package/dist/isNumericString.d.ts +10 -0
- package/dist/isNumericString.d.ts.map +1 -0
- package/dist/isNumericString.js +61 -0
- package/dist/isNumericString.js.map +1 -0
- package/dist/occurrences.d.ts +7 -0
- package/dist/occurrences.d.ts.map +1 -0
- package/dist/occurrences.js +27 -0
- package/dist/occurrences.js.map +1 -0
- package/dist/stripPrefix.d.ts +3 -0
- package/dist/stripPrefix.d.ts.map +1 -0
- package/dist/stripPrefix.js +11 -0
- package/dist/stripPrefix.js.map +1 -0
- package/dist/stripSuffix.d.ts +3 -0
- package/dist/stripSuffix.d.ts.map +1 -0
- package/dist/stripSuffix.js +11 -0
- package/dist/stripSuffix.js.map +1 -0
- package/docs/assets/search.js +1 -1
- package/docs/functions/cap.html +15 -5
- package/docs/functions/capitalize.html +15 -5
- package/docs/functions/coalesce.html +15 -5
- package/docs/functions/ensureArray.html +15 -5
- package/docs/functions/ensureDate.html +126 -0
- package/docs/functions/ensureError.html +15 -5
- package/docs/functions/ensurePrefix.html +128 -0
- package/docs/functions/ensureSuffix.html +128 -0
- package/docs/functions/ensureTimestamp.html +126 -0
- package/docs/functions/get.html +15 -5
- package/docs/functions/getMultiple.html +15 -5
- package/docs/functions/insertSeparator.html +15 -5
- package/docs/functions/isEmpty.html +15 -5
- package/docs/functions/isNumericString.html +123 -0
- package/docs/functions/isPlainObject.html +15 -5
- package/docs/functions/last.html +15 -5
- package/docs/functions/mapAsync.html +15 -5
- package/docs/functions/mapValues.html +15 -5
- package/docs/functions/match.html +15 -5
- package/docs/functions/merge.html +23 -13
- package/docs/functions/mostFrequent.html +15 -5
- package/docs/functions/noop.html +15 -5
- package/docs/functions/occurrences.html +135 -0
- package/docs/functions/omit.html +15 -5
- package/docs/functions/pick.html +15 -5
- package/docs/functions/pull.html +15 -5
- package/docs/functions/remove.html +15 -5
- package/docs/functions/rethrow.html +15 -5
- package/docs/functions/scale.html +15 -5
- package/docs/functions/seq.html +15 -5
- package/docs/functions/seqEarlyBreak.html +15 -5
- package/docs/functions/set.html +15 -5
- package/docs/functions/setImmutable.html +15 -5
- package/docs/functions/sortBy.html +15 -5
- package/docs/functions/stripPrefix.html +122 -0
- package/docs/functions/stripSuffix.html +122 -0
- package/docs/functions/throttle.html +15 -5
- package/docs/functions/truthy.html +15 -5
- package/docs/functions/wait.html +15 -5
- package/docs/functions/waitFor.html +15 -5
- package/docs/functions/waitSync.html +15 -5
- package/docs/index.html +86 -22
- package/docs/interfaces/GetMultipleSource.html +15 -5
- package/docs/interfaces/GetSource.html +15 -5
- package/docs/interfaces/IsNumericStringOptions.html +90 -0
- package/docs/interfaces/OccurencesOptions.html +71 -0
- package/docs/interfaces/SetImmutableSource.html +15 -5
- package/docs/interfaces/SetSource.html +15 -5
- package/docs/interfaces/ThrottleOptions.html +7 -7
- package/docs/interfaces/ThrottledFunctionExtras.html +7 -7
- package/docs/modules.html +24 -4
- package/docs/pages/Introduction.html +14 -4
- package/docs/types/MapValuesFn.html +15 -5
- package/docs/types/MatchCallback.html +15 -5
- package/docs/types/SeqEarlyBreaker.html +15 -5
- package/docs/types/SeqFn.html +15 -5
- package/docs/types/SeqFunctions.html +15 -5
- package/docs/types/SetImmutablePath.html +15 -5
- package/docs/types/ThrottledFunction.html +15 -5
- package/docs/variables/mapValuesUNSET.html +15 -5
- package/docs/variables/mergeUNSET.html +15 -5
- package/esm/ensureDate.d.ts +3 -0
- package/esm/ensureDate.d.ts.map +1 -0
- package/esm/ensureDate.js +8 -0
- package/esm/ensureDate.js.map +1 -0
- package/esm/ensurePrefix.d.ts +3 -0
- package/esm/ensurePrefix.d.ts.map +1 -0
- package/esm/ensurePrefix.js +8 -0
- package/esm/ensurePrefix.js.map +1 -0
- package/esm/ensureSuffix.d.ts +3 -0
- package/esm/ensureSuffix.d.ts.map +1 -0
- package/esm/ensureSuffix.js +8 -0
- package/esm/ensureSuffix.js.map +1 -0
- package/esm/ensureTimestamp.d.ts +3 -0
- package/esm/ensureTimestamp.d.ts.map +1 -0
- package/esm/ensureTimestamp.js +8 -0
- package/esm/ensureTimestamp.js.map +1 -0
- package/esm/index.d.ts +8 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +8 -0
- package/esm/index.js.map +1 -1
- package/esm/isEmpty.js +1 -1
- package/esm/isEmpty.js.map +1 -1
- package/esm/isNumericString.d.ts +10 -0
- package/esm/isNumericString.d.ts.map +1 -0
- package/esm/isNumericString.js +58 -0
- package/esm/isNumericString.js.map +1 -0
- package/esm/occurrences.d.ts +7 -0
- package/esm/occurrences.d.ts.map +1 -0
- package/esm/occurrences.js +24 -0
- package/esm/occurrences.js.map +1 -0
- package/esm/stripPrefix.d.ts +3 -0
- package/esm/stripPrefix.d.ts.map +1 -0
- package/esm/stripPrefix.js +8 -0
- package/esm/stripPrefix.js.map +1 -0
- package/esm/stripSuffix.d.ts +3 -0
- package/esm/stripSuffix.d.ts.map +1 -0
- package/esm/stripSuffix.js +8 -0
- package/esm/stripSuffix.js.map +1 -0
- package/package.json +1 -1
- package/src/ensureDate.spec.ts +13 -0
- package/src/ensureDate.ts +18 -0
- package/src/ensurePrefix.spec.ts +11 -0
- package/src/ensurePrefix.ts +18 -0
- package/src/ensureSuffix.spec.ts +11 -0
- package/src/ensureSuffix.ts +18 -0
- package/src/ensureTimestamp.spec.ts +11 -0
- package/src/ensureTimestamp.ts +18 -0
- package/src/index.ts +8 -0
- package/src/isEmpty.ts +1 -1
- package/src/isNumericString.spec.ts +100 -0
- package/src/isNumericString.ts +94 -0
- package/src/occurrences.spec.ts +20 -0
- package/src/occurrences.ts +53 -0
- package/src/stripPrefix.spec.ts +13 -0
- package/src/stripPrefix.ts +15 -0
- package/src/stripSuffix.spec.ts +13 -0
- 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
|
+
};
|