@ezez/utils 4.0.0 → 4.1.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 +11 -0
- package/dist/cap.js.map +1 -1
- package/dist/coalesce.d.ts.map +1 -1
- package/dist/coalesce.js.map +1 -1
- package/dist/compareArrays.d.ts.map +1 -1
- package/dist/compareProps.d.ts.map +1 -1
- package/dist/compareProps.js.map +1 -1
- package/dist/deserialize.d.ts.map +1 -1
- package/dist/deserialize.js.map +1 -1
- package/dist/ensureArray.d.ts.map +1 -1
- package/dist/ensureArray.js.map +1 -1
- package/dist/ensureDate.js.map +1 -1
- package/dist/ensureError.js.map +1 -1
- package/dist/ensurePrefix.js.map +1 -1
- package/dist/ensureSuffix.js.map +1 -1
- package/dist/ensureTimestamp.js.map +1 -1
- package/dist/escapeRegExp.d.ts.map +1 -1
- package/dist/escapeRegExp.js +1 -1
- package/dist/escapeRegExp.js.map +1 -1
- package/dist/formatDate.js +1 -1
- package/dist/formatDate.js.map +1 -1
- package/dist/get.js.map +1 -1
- package/dist/getMultiple.d.ts.map +1 -1
- package/dist/getMultiple.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/insertSeparator.d.ts.map +1 -1
- package/dist/insertSeparator.js.map +1 -1
- package/dist/isEmpty.js.map +1 -1
- package/dist/isNumericString.js +1 -1
- package/dist/isNumericString.js.map +1 -1
- package/dist/last.d.ts.map +1 -1
- package/dist/later.d.ts.map +1 -1
- package/dist/mapAsync.d.ts.map +1 -1
- package/dist/mapAsync.js.map +1 -1
- package/dist/mapValues.d.ts.map +1 -1
- package/dist/mapValues.js.map +1 -1
- package/dist/match.d.ts.map +1 -1
- package/dist/match.js.map +1 -1
- package/dist/memoize.d.ts +3 -0
- package/dist/memoize.d.ts.map +1 -0
- package/dist/memoize.js +19 -0
- package/dist/memoize.js.map +1 -0
- package/dist/merge.d.ts +11 -7
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js.map +1 -1
- package/dist/mostFrequent.d.ts.map +1 -1
- package/dist/mostFrequent.js.map +1 -1
- package/dist/occurrences.js.map +1 -1
- package/dist/omit.d.ts.map +1 -1
- package/dist/omit.js.map +1 -1
- package/dist/pick.d.ts.map +1 -1
- package/dist/pick.js.map +1 -1
- package/dist/pull.d.ts.map +1 -1
- package/dist/pull.js.map +1 -1
- package/dist/remove.d.ts.map +1 -1
- package/dist/remove.js +1 -1
- package/dist/remove.js.map +1 -1
- package/dist/removeCommonProperties.d.ts.map +1 -1
- package/dist/removeCommonProperties.js +3 -1
- package/dist/removeCommonProperties.js.map +1 -1
- package/dist/replace.js +1 -1
- package/dist/replace.js.map +1 -1
- package/dist/replaceDeep.d.ts.map +1 -1
- package/dist/replaceDeepByFn.d.ts.map +1 -1
- package/dist/replaceDeepByFn.js.map +1 -1
- package/dist/safe.js.map +1 -1
- package/dist/sample.d.ts +3 -1
- package/dist/sample.d.ts.map +1 -1
- package/dist/sample.js.map +1 -1
- package/dist/samples.d.ts.map +1 -1
- package/dist/samples.js.map +1 -1
- package/dist/seq.d.ts.map +1 -1
- package/dist/seq.js +1 -1
- package/dist/seq.js.map +1 -1
- package/dist/serialize.js.map +1 -1
- package/dist/set.js.map +1 -1
- package/dist/setImmutable.js.map +1 -1
- package/dist/shuffle.d.ts.map +1 -1
- package/dist/sortBy.d.ts.map +1 -1
- package/dist/sortBy.js.map +1 -1
- package/dist/sortProps.d.ts.map +1 -1
- package/dist/sortProps.js.map +1 -1
- package/dist/stripPrefix.js.map +1 -1
- package/dist/stripSuffix.js.map +1 -1
- package/dist/throttle.d.ts.map +1 -1
- package/dist/throttle.js.map +1 -1
- package/dist/toggle.d.ts.map +1 -1
- package/dist/toggle.js.map +1 -1
- package/dist/trimEnd.js.map +1 -1
- package/dist/trimStart.js.map +1 -1
- package/dist/truthy.d.ts +1 -1
- package/dist/truthy.d.ts.map +1 -1
- package/dist/unique.d.ts.map +1 -1
- package/dist/waitFor.d.ts.map +1 -1
- package/dist/waitFor.js +1 -1
- package/dist/waitFor.js.map +1 -1
- package/dist/waitSync.js.map +1 -1
- package/docs/assets/icons.js +15 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +4 -3
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +544 -394
- package/docs/documents/CHANGELOG.html +337 -0
- package/docs/functions/index.cap.html +5 -0
- package/docs/functions/index.capitalize.html +13 -0
- package/docs/functions/index.coalesce.html +16 -0
- package/docs/functions/index.compareArrays.html +8 -0
- package/docs/functions/index.compareProps.html +11 -0
- package/docs/functions/index.deserialize.html +6 -0
- package/docs/functions/index.ensureArray.html +3 -0
- package/docs/functions/index.ensureDate.html +10 -0
- package/docs/functions/index.ensureError.html +14 -0
- package/docs/functions/index.ensurePrefix.html +10 -0
- package/docs/functions/index.ensureSuffix.html +10 -0
- package/docs/functions/index.ensureTimestamp.html +10 -0
- package/docs/functions/index.escapeRegExp.html +7 -0
- package/docs/functions/index.formatDate.html +6 -0
- package/docs/functions/index.get.html +26 -0
- package/docs/functions/index.getMultiple.html +16 -0
- package/docs/functions/index.insertSeparator.html +7 -0
- package/docs/functions/index.isEmpty.html +33 -0
- package/docs/functions/index.isNumericString.html +5 -0
- package/docs/functions/index.isPlainObject.html +18 -0
- package/docs/functions/index.last.html +15 -0
- package/docs/functions/index.later-1.html +6 -0
- package/docs/functions/index.mapAsync.html +8 -0
- package/docs/functions/index.mapValues.html +14 -0
- package/docs/functions/index.match.html +4 -0
- package/docs/functions/index.memoize.html +8 -0
- package/docs/functions/index.merge.html +13 -0
- package/docs/functions/index.mostFrequent.html +2 -0
- package/docs/functions/index.noop.html +2 -0
- package/docs/functions/index.occurrences.html +14 -0
- package/docs/functions/index.omit.html +18 -0
- package/docs/functions/index.pick.html +13 -0
- package/docs/functions/index.pull.html +2 -0
- package/docs/functions/index.remove.html +2 -0
- package/docs/functions/index.removeCommonProperties.html +18 -0
- package/docs/functions/index.replace.html +10 -0
- package/docs/functions/index.replaceDeep.html +15 -0
- package/docs/functions/index.rethrow.html +2 -0
- package/docs/functions/index.round.html +7 -0
- package/docs/functions/index.safe.html +7 -0
- package/docs/functions/index.sample.html +6 -0
- package/docs/functions/index.samples.html +7 -0
- package/docs/functions/index.scale.html +5 -0
- package/docs/functions/index.seq.html +17 -0
- package/docs/functions/index.seqEarlyBreak.html +12 -0
- package/docs/functions/index.serialize.html +14 -0
- package/docs/functions/index.set.html +26 -0
- package/docs/functions/index.setImmutable.html +25 -0
- package/docs/functions/index.shuffle.html +3 -0
- package/docs/functions/index.sortBy.html +6 -0
- package/docs/functions/index.sortProps.html +10 -0
- package/docs/functions/index.stripPrefix.html +4 -0
- package/docs/functions/index.stripSuffix.html +4 -0
- package/docs/functions/index.throttle.html +14 -0
- package/docs/functions/index.toggle.html +5 -0
- package/docs/functions/index.trim.html +8 -0
- package/docs/functions/index.trimEnd.html +8 -0
- package/docs/functions/index.trimStart.html +8 -0
- package/docs/functions/index.truthy.html +7 -0
- package/docs/functions/index.unique.html +6 -0
- package/docs/functions/index.wait.html +3 -0
- package/docs/functions/index.waitFor.html +10 -0
- package/docs/functions/index.waitSync.html +3 -0
- package/docs/index.html +18 -207
- package/docs/interfaces/index.ComparePropsOptions.html +5 -0
- package/docs/interfaces/index.GetMultipleSource.html +3 -0
- package/docs/interfaces/index.GetSource.html +3 -0
- package/docs/interfaces/index.IsNumericStringOptions.html +5 -0
- package/docs/interfaces/index.OccurencesOptions.html +3 -0
- package/docs/interfaces/index.SetImmutableSource.html +3 -0
- package/docs/interfaces/index.SetSource.html +3 -0
- package/docs/interfaces/index.ThrottleOptions.html +5 -0
- package/docs/interfaces/index.ThrottledFunctionExtras.html +5 -0
- package/docs/modules/index.html +86 -0
- package/docs/types/index.CustomDeserializers.html +1 -0
- package/docs/types/index.CustomSerializers.html +1 -0
- package/docs/types/index.Later.html +4 -0
- package/docs/types/index.MapValuesFn.html +14 -0
- package/docs/types/index.MatchCallback.html +1 -0
- package/docs/types/index.MergeTwo.html +3 -0
- package/docs/types/index.SeqEarlyBreaker.html +4 -0
- package/docs/types/index.SeqFn.html +3 -0
- package/docs/types/index.SeqFunctions.html +4 -0
- package/docs/types/index.SetImmutablePath.html +4 -0
- package/docs/types/index.ThrottledFunction.html +1 -0
- package/docs/variables/index.mapValuesUNSET.html +2 -0
- package/docs/variables/index.mergeUNSET.html +4 -0
- package/esm/cap.js.map +1 -1
- package/esm/coalesce.d.ts.map +1 -1
- package/esm/coalesce.js.map +1 -1
- package/esm/compareArrays.d.ts.map +1 -1
- package/esm/compareProps.d.ts.map +1 -1
- package/esm/compareProps.js.map +1 -1
- package/esm/deserialize.d.ts.map +1 -1
- package/esm/deserialize.js.map +1 -1
- package/esm/ensureArray.d.ts.map +1 -1
- package/esm/ensureArray.js.map +1 -1
- package/esm/ensureDate.js.map +1 -1
- package/esm/ensureError.js.map +1 -1
- package/esm/ensurePrefix.js.map +1 -1
- package/esm/ensureSuffix.js.map +1 -1
- package/esm/ensureTimestamp.js.map +1 -1
- package/esm/escapeRegExp.d.ts.map +1 -1
- package/esm/escapeRegExp.js +1 -1
- package/esm/escapeRegExp.js.map +1 -1
- package/esm/formatDate.js +1 -1
- package/esm/formatDate.js.map +1 -1
- package/esm/get.js.map +1 -1
- package/esm/getMultiple.d.ts.map +1 -1
- package/esm/getMultiple.js.map +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/insertSeparator.d.ts.map +1 -1
- package/esm/insertSeparator.js.map +1 -1
- package/esm/isEmpty.js.map +1 -1
- package/esm/isNumericString.js +1 -1
- package/esm/isNumericString.js.map +1 -1
- package/esm/last.d.ts.map +1 -1
- package/esm/later.d.ts.map +1 -1
- package/esm/mapAsync.d.ts.map +1 -1
- package/esm/mapAsync.js.map +1 -1
- package/esm/mapValues.d.ts.map +1 -1
- package/esm/mapValues.js.map +1 -1
- package/esm/match.d.ts.map +1 -1
- package/esm/match.js.map +1 -1
- package/esm/memoize.d.ts +3 -0
- package/esm/memoize.d.ts.map +1 -0
- package/esm/memoize.js +16 -0
- package/esm/memoize.js.map +1 -0
- package/esm/merge.d.ts +11 -7
- package/esm/merge.d.ts.map +1 -1
- package/esm/merge.js.map +1 -1
- package/esm/mostFrequent.d.ts.map +1 -1
- package/esm/mostFrequent.js.map +1 -1
- package/esm/occurrences.js.map +1 -1
- package/esm/omit.d.ts.map +1 -1
- package/esm/omit.js.map +1 -1
- package/esm/pick.d.ts.map +1 -1
- package/esm/pick.js.map +1 -1
- package/esm/pull.d.ts.map +1 -1
- package/esm/pull.js.map +1 -1
- package/esm/remove.d.ts.map +1 -1
- package/esm/remove.js +1 -1
- package/esm/remove.js.map +1 -1
- package/esm/removeCommonProperties.d.ts.map +1 -1
- package/esm/removeCommonProperties.js +3 -1
- package/esm/removeCommonProperties.js.map +1 -1
- package/esm/replace.js +1 -1
- package/esm/replace.js.map +1 -1
- package/esm/replaceDeep.d.ts.map +1 -1
- package/esm/replaceDeepByFn.d.ts.map +1 -1
- package/esm/replaceDeepByFn.js.map +1 -1
- package/esm/safe.js.map +1 -1
- package/esm/sample.d.ts +3 -1
- package/esm/sample.d.ts.map +1 -1
- package/esm/sample.js.map +1 -1
- package/esm/samples.d.ts.map +1 -1
- package/esm/samples.js.map +1 -1
- package/esm/seq.d.ts.map +1 -1
- package/esm/seq.js +1 -1
- package/esm/seq.js.map +1 -1
- package/esm/serialize.js.map +1 -1
- package/esm/set.js.map +1 -1
- package/esm/setImmutable.js.map +1 -1
- package/esm/shuffle.d.ts.map +1 -1
- package/esm/sortBy.d.ts.map +1 -1
- package/esm/sortBy.js.map +1 -1
- package/esm/sortProps.d.ts.map +1 -1
- package/esm/sortProps.js.map +1 -1
- package/esm/stripPrefix.js.map +1 -1
- package/esm/stripSuffix.js.map +1 -1
- package/esm/throttle.d.ts.map +1 -1
- package/esm/throttle.js.map +1 -1
- package/esm/toggle.d.ts.map +1 -1
- package/esm/toggle.js.map +1 -1
- package/esm/trimEnd.js.map +1 -1
- package/esm/trimStart.js.map +1 -1
- package/esm/truthy.d.ts +1 -1
- package/esm/truthy.d.ts.map +1 -1
- package/esm/unique.d.ts.map +1 -1
- package/esm/waitFor.d.ts.map +1 -1
- package/esm/waitFor.js +1 -1
- package/esm/waitFor.js.map +1 -1
- package/esm/waitSync.js.map +1 -1
- package/package.json +10 -17
- package/pnpm-lock.yaml +661 -386
- package/src/compareProps.ts +9 -2
- package/src/deserialize.spec.ts +1 -0
- package/src/escapeRegExp.spec.ts +5 -3
- package/src/escapeRegExp.ts +3 -2
- package/src/formatDate.ts +2 -2
- package/src/get.spec.ts +1 -0
- package/src/getMultiple.ts +1 -0
- package/src/index.ts +1 -0
- package/src/isNumericString.ts +3 -3
- package/src/memoize.spec.ts +90 -0
- package/src/memoize.ts +35 -0
- package/src/merge.ts +30 -8
- package/src/mostFrequent.ts +1 -0
- package/src/remove.ts +1 -1
- package/src/removeCommonProperties.ts +4 -2
- package/src/replace.ts +1 -1
- package/src/rethrow.ts +1 -1
- package/src/sample.spec.ts +1 -0
- package/src/sample.ts +18 -2
- package/src/samples.ts +1 -1
- package/src/seq.spec.ts +6 -3
- package/src/seq.ts +1 -1
- package/src/serialize.spec.ts +1 -0
- package/src/serialize.ts +1 -1
- package/src/set.ts +1 -1
- package/src/setImmutable.ts +1 -1
- package/src/sortBy.ts +1 -1
- package/src/throttle.ts +1 -1
- package/src/waitFor.spec.ts +7 -2
- package/src/waitFor.ts +1 -1
- package/typedoc.cjs +2 -4
- package/docs/assets/pages.css +0 -14
- package/docs/functions/cap.html +0 -152
- package/docs/functions/capitalize.html +0 -157
- package/docs/functions/coalesce.html +0 -162
- package/docs/functions/compareArrays.html +0 -165
- package/docs/functions/compareProps.html +0 -164
- package/docs/functions/deserialize.html +0 -156
- package/docs/functions/ensureArray.html +0 -150
- package/docs/functions/ensureDate.html +0 -152
- package/docs/functions/ensureError.html +0 -156
- package/docs/functions/ensurePrefix.html +0 -154
- package/docs/functions/ensureSuffix.html +0 -154
- package/docs/functions/ensureTimestamp.html +0 -152
- package/docs/functions/escapeRegExp.html +0 -148
- package/docs/functions/formatDate.html +0 -150
- package/docs/functions/get.html +0 -174
- package/docs/functions/getMultiple.html +0 -165
- package/docs/functions/insertSeparator.html +0 -159
- package/docs/functions/isEmpty.html +0 -175
- package/docs/functions/isNumericString.html +0 -149
- package/docs/functions/isPlainObject.html +0 -159
- package/docs/functions/last.html +0 -162
- package/docs/functions/later-1.html +0 -147
- package/docs/functions/mapAsync.html +0 -180
- package/docs/functions/mapValues.html +0 -166
- package/docs/functions/match.html +0 -158
- package/docs/functions/merge.html +0 -500
- package/docs/functions/mostFrequent.html +0 -147
- package/docs/functions/noop.html +0 -137
- package/docs/functions/occurrences.html +0 -161
- package/docs/functions/omit.html +0 -169
- package/docs/functions/pick.html +0 -165
- package/docs/functions/pull.html +0 -149
- package/docs/functions/remove.html +0 -165
- package/docs/functions/removeCommonProperties.html +0 -164
- package/docs/functions/replace.html +0 -154
- package/docs/functions/replaceDeep.html +0 -170
- package/docs/functions/rethrow.html +0 -142
- package/docs/functions/round.html +0 -151
- package/docs/functions/safe.html +0 -192
- package/docs/functions/sample.html +0 -149
- package/docs/functions/samples.html +0 -159
- package/docs/functions/scale.html +0 -153
- package/docs/functions/seq.html +0 -164
- package/docs/functions/seqEarlyBreak.html +0 -162
- package/docs/functions/serialize.html +0 -161
- package/docs/functions/set.html +0 -174
- package/docs/functions/setImmutable.html +0 -173
- package/docs/functions/shuffle.html +0 -149
- package/docs/functions/sortBy.html +0 -171
- package/docs/functions/sortProps.html +0 -159
- package/docs/functions/stripPrefix.html +0 -148
- package/docs/functions/stripSuffix.html +0 -148
- package/docs/functions/throttle.html +0 -167
- package/docs/functions/toggle.html +0 -154
- package/docs/functions/trim.html +0 -152
- package/docs/functions/trimEnd.html +0 -152
- package/docs/functions/trimStart.html +0 -152
- package/docs/functions/truthy.html +0 -154
- package/docs/functions/unique.html +0 -152
- package/docs/functions/wait.html +0 -145
- package/docs/functions/waitFor.html +0 -164
- package/docs/functions/waitSync.html +0 -145
- package/docs/interfaces/ComparePropsOptions.html +0 -70
- package/docs/interfaces/GetMultipleSource.html +0 -142
- package/docs/interfaces/GetSource.html +0 -142
- package/docs/interfaces/IsNumericStringOptions.html +0 -91
- package/docs/interfaces/OccurencesOptions.html +0 -72
- package/docs/interfaces/SetImmutableSource.html +0 -142
- package/docs/interfaces/SetSource.html +0 -142
- package/docs/interfaces/ThrottleOptions.html +0 -81
- package/docs/interfaces/ThrottledFunctionExtras.html +0 -97
- package/docs/modules.html +0 -223
- package/docs/pages/CHANGELOG.html +0 -973
- package/docs/pages/Introduction.html +0 -130
- package/docs/types/CustomDeserializers.html +0 -159
- package/docs/types/CustomSerializers.html +0 -159
- package/docs/types/Later.html +0 -173
- package/docs/types/MapValuesFn.html +0 -170
- package/docs/types/MatchCallback.html +0 -149
- package/docs/types/SeqEarlyBreaker.html +0 -150
- package/docs/types/SeqFn.html +0 -148
- package/docs/types/SeqFunctions.html +0 -141
- package/docs/types/SetImmutablePath.html +0 -135
- package/docs/types/ThrottledFunction.html +0 -149
- package/docs/variables/mapValuesUNSET.html +0 -137
- package/docs/variables/mergeUNSET.html +0 -139
- package/tutorials/Introduction.md +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>setImmutable | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.setImmutable.html">setImmutable</a></li></ul><h1>Function setImmutable</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Updates the value at given path of given object. It does not mutate the object but returns a new one. If path is not
|
|
2
|
+
found then objects are created "on the way". If non-objects are found, they are replaced with new plain objects. If
|
|
3
|
+
primitives are used as source they are ignored and returned value is empty object with updated value at given path.</p>
|
|
4
|
+
<p>This is still too dynamic in nature to get full TypeScript support. Properties are not typed, return type is unknown.
|
|
5
|
+
It is recommended to use <code>immutable-assign</code> package instead.</p>
|
|
6
|
+
</div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">set</span><span class="hl-1">(</span><span class="hl-3">object</span><span class="hl-1">, </span><span class="hl-7">"deep.property"</span><span class="hl-1">, </span><span class="hl-3">value</span><span class="hl-1">)</span>
|
|
7
|
+
</code><button type="button">Copy</button></pre>
|
|
8
|
+
|
|
9
|
+
<h4>Example</h4><pre><code class="ts"><span class="hl-2">set</span><span class="hl-1">(</span><span class="hl-3">object</span><span class="hl-1">, [</span><span class="hl-7">"deep"</span><span class="hl-1">, </span><span class="hl-7">"property"</span><span class="hl-1">], </span><span class="hl-3">value</span><span class="hl-1">)</span>
|
|
10
|
+
</code><button type="button">Copy</button></pre>
|
|
11
|
+
|
|
12
|
+
<h4>Example</h4><pre><code class="ts"><span class="hl-2">set</span><span class="hl-1">({}, </span><span class="hl-7">"deep[0].property"</span><span class="hl-1">, </span><span class="hl-3">value</span><span class="hl-1">)</span><br/><span class="hl-6">// will create this structure:</span><br/><span class="hl-1">{ </span><span class="hl-7">"deep[0]"</span><span class="hl-1">: { </span><span class="hl-7">"property"</span><span class="hl-3">:</span><span class="hl-1"> </span><span class="hl-3">value</span><span class="hl-1"> }}</span>
|
|
13
|
+
</code><button type="button">Copy</button></pre>
|
|
14
|
+
|
|
15
|
+
<h4>Example</h4><pre><code class="ts"><span class="hl-2">set</span><span class="hl-1">({}, </span><span class="hl-7">"items.0"</span><span class="hl-1">, </span><span class="hl-3">value</span><span class="hl-1">)</span><br/><span class="hl-6">// will create an object, not an array</span><br/><span class="hl-1">{ </span><span class="hl-7">"items"</span><span class="hl-1">: { </span><span class="hl-7">"0"</span><span class="hl-3">:</span><span class="hl-1"> </span><span class="hl-3">value</span><span class="hl-1"> }}</span>
|
|
16
|
+
</code><button type="button">Copy</button></pre>
|
|
17
|
+
|
|
18
|
+
</div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="setImmutable" class="tsd-anchor"></a><span class="tsd-kind-call-signature">set<wbr/>Immutable</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">source</span>, <span class="tsd-kind-parameter">path</span>, <span class="tsd-kind-parameter">value</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span><a href="#setImmutable" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">source</span>: <a href="../interfaces/index.SetImmutableSource.html" class="tsd-signature-type tsd-kind-interface">SetImmutableSource</a></span><div class="tsd-comment tsd-typography"><p>source object to mutate</p>
|
|
19
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">path</span>: <a href="../types/index.SetImmutablePath.html" class="tsd-signature-type tsd-kind-type-alias">SetImmutablePath</a></span><div class="tsd-comment tsd-typography"><p>path where value should be stored, written as dot-separated
|
|
20
|
+
property names or array with property names. Use Array when your keys includes dots.</p>
|
|
21
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">unknown</span></span><div class="tsd-comment tsd-typography"><p>value to be set</p>
|
|
22
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">unknown</span></h4><ul>
|
|
23
|
+
<li>given object or new object if source was primitive</li>
|
|
24
|
+
</ul>
|
|
25
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/setImmutable.ts#L70">setImmutable.ts:70</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>shuffle | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.shuffle.html">shuffle</a></li></ul><h1>Function shuffle</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Shuffles an array, returning a new array.</p>
|
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="shuffle" class="tsd-anchor"></a><span class="tsd-kind-call-signature">shuffle</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.shuffle.html#shuffle.T">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">array</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.shuffle.html#shuffle.T">T</a><span class="tsd-signature-symbol">[]</span><a href="#shuffle" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="shuffle.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">array</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.shuffle.html#shuffle.T">T</a><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>source array</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="index.shuffle.html#shuffle.T">T</a><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/shuffle.ts#L7">shuffle.ts:7</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>sortBy | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.sortBy.html">sortBy</a></li></ul><h1>Function sortBy</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Returns a function that can be used as a callback to <code>.sort()</code> method. Returned function will sort array by given
|
|
2
|
+
property.</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="sortBy" class="tsd-anchor"></a><span class="tsd-kind-call-signature">sort<wbr/>By</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.sortBy.html#sortBy.T">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">propertyName</span>, <span class="tsd-kind-parameter">asc</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">defaultValue</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">a</span>, <span class="tsd-kind-parameter">b</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">-1</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">0</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">1</span><span class="tsd-signature-symbol">)</span><a href="#sortBy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="sortBy.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">propertyName</span>: <span class="tsd-signature-keyword">keyof </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.sortBy.html#sortBy.T">T</a></span><div class="tsd-comment tsd-typography"><p>name of the property to sort by</p>
|
|
4
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">asc</span>: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></span><div class="tsd-comment tsd-typography"><p>should sort be ascending?</p>
|
|
5
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">defaultValue</span>: <span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol"> = null</span></span><div class="tsd-comment tsd-typography"><p>value to use when property is not defined in one of the objects</p>
|
|
6
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">a</span>, <span class="tsd-kind-parameter">b</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">-1</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">0</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">1</span><span class="tsd-signature-symbol">)</span></h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="sortBy.__type.__type-1"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">a</span>, <span class="tsd-kind-parameter">b</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">-1</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">0</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">1</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">a</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.sortBy.html#sortBy.T">T</a></span></li><li><span><span class="tsd-kind-parameter">b</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.sortBy.html#sortBy.T">T</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">-1</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">0</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">1</span></h4></li></ul></li></ul><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/sortBy.ts#L8">sortBy.ts:8</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>sortProps | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.sortProps.html">sortProps</a></li></ul><h1>Function sortProps</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Sorts the properties of an object alphabetically, ascending or descending.
|
|
2
|
+
It does not mutate the original object.</p>
|
|
3
|
+
<p>REMEMBER: In theory, JS engines do not guarantee the order of object properties.
|
|
4
|
+
In practice most of the popular engines do.</p>
|
|
5
|
+
</div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">sortProps</span><span class="hl-1">({ </span><span class="hl-3">b:</span><span class="hl-1"> </span><span class="hl-5">2</span><span class="hl-1">, </span><span class="hl-3">a:</span><span class="hl-1"> </span><span class="hl-5">1</span><span class="hl-1">, </span><span class="hl-3">z:</span><span class="hl-1"> </span><span class="hl-5">26</span><span class="hl-1"> }) </span><span class="hl-6">// { a: 1, b: 2, z: 26 }</span>
|
|
6
|
+
</code><button type="button">Copy</button></pre>
|
|
7
|
+
|
|
8
|
+
</div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="sortProps" class="tsd-anchor"></a><span class="tsd-kind-call-signature">sort<wbr/>Props</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.sortProps.html#sortProps.T">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">object</span>, <span class="tsd-kind-parameter">asc</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.sortProps.html#sortProps.T">T</a><a href="#sortProps" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="sortProps.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">object</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.sortProps.html#sortProps.T">T</a></span><div class="tsd-comment tsd-typography"><p>source object</p>
|
|
9
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">asc</span>: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = true</span></span><div class="tsd-comment tsd-typography"><p>sort ascending?</p>
|
|
10
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="index.sortProps.html#sortProps.T">T</a></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/sortProps.ts#L11">sortProps.ts:11</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>stripPrefix | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.stripPrefix.html">stripPrefix</a></li></ul><h1>Function stripPrefix</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Strip a prefix from a string.</p>
|
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="stripPrefix" class="tsd-anchor"></a><span class="tsd-kind-call-signature">strip<wbr/>Prefix</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">from</span>, <span class="tsd-kind-parameter">prefix</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#stripPrefix" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">from</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>string to strip prefix from</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">prefix</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>prefix to strip</p>
|
|
4
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/stripPrefix.ts#L6">stripPrefix.ts:6</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>stripSuffix | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.stripSuffix.html">stripSuffix</a></li></ul><h1>Function stripSuffix</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Strip a suffix from a string.</p>
|
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="stripSuffix" class="tsd-anchor"></a><span class="tsd-kind-call-signature">strip<wbr/>Suffix</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">from</span>, <span class="tsd-kind-parameter">suffix</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#stripSuffix" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">from</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>string to strip suffix from</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">suffix</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>suffix to strip</p>
|
|
4
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/stripSuffix.ts#L7">stripSuffix.ts:7</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>throttle | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.throttle.html">throttle</a></li></ul><h1>Function throttle</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Creates a throttled function that calls given function only once every given time. Throttled function takes the same
|
|
2
|
+
arguments, returns "cached" value of last "real" call to the given function.
|
|
3
|
+
Time (in ms) can be specified as an array - each "real" call to the function will then pick next value of that array
|
|
4
|
+
as a time to wait for the next "real" call. This is useful for throttled notifications or auto-retries. Last value of
|
|
5
|
+
the array will be used if no more values.
|
|
6
|
+
Returned function also includes <code>cancel</code> property - call it to stop any planned calls (and reset the <code>time</code> array
|
|
7
|
+
progress) and <code>flush</code> property - call it to immediately run planned call.</p>
|
|
8
|
+
<p>You can provide options to specify if function should be invoked immediately on first call to throttled function
|
|
9
|
+
(<code>leading</code> property) and if it should be called after given time (<code>trailing</code> property).</p>
|
|
10
|
+
<p>If (this is default) both <code>leading</code> and <code>trailing</code> property are true then it's required to call throttled function at
|
|
11
|
+
least twice.</p>
|
|
12
|
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="throttle" class="tsd-anchor"></a><span class="tsd-kind-call-signature">throttle</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.throttle.html#throttle.RT">RT</a><span class="tsd-signature-symbol">, </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.throttle.html#throttle.F">F</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span>, <span class="tsd-kind-parameter">time</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../types/index.ThrottledFunction.html" class="tsd-signature-type tsd-kind-type-alias">ThrottledFunction</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.throttle.html#throttle.F">F</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> & </span><a href="../interfaces/index.ThrottledFunctionExtras.html" class="tsd-signature-type tsd-kind-interface">ThrottledFunctionExtras</a><a href="#throttle" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="throttle.RT" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">RT</span></span></li><li><span><a id="throttle.F" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">F</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.throttle.html#throttle.RT">RT</a><span class="tsd-signature-symbol">)</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.throttle.html#throttle.F">F</a></span><div class="tsd-comment tsd-typography"><p>function to throttle</p>
|
|
13
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">time</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">...</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol"> = 0</span></span><div class="tsd-comment tsd-typography"><p>throttle time as number or array of numbers (min 1 element)</p>
|
|
14
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">options</span>: <a href="../interfaces/index.ThrottleOptions.html" class="tsd-signature-type tsd-kind-interface">ThrottleOptions</a></span><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="../types/index.ThrottledFunction.html" class="tsd-signature-type tsd-kind-type-alias">ThrottledFunction</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.throttle.html#throttle.F">F</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> & </span><a href="../interfaces/index.ThrottledFunctionExtras.html" class="tsd-signature-type tsd-kind-interface">ThrottledFunctionExtras</a></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/throttle.ts#L49">throttle.ts:49</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>toggle | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.toggle.html">toggle</a></li></ul><h1>Function toggle</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Toggles an item in an array. If it exists, remove it. If it doesn't exist, add it.
|
|
2
|
+
If the array contains the given value more than once, this function will remove only one occurrence.</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="toggle" class="tsd-anchor"></a><span class="tsd-kind-call-signature">toggle</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.toggle.html#toggle.T">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">array</span>, <span class="tsd-kind-parameter">item</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.toggle.html#toggle.T">T</a><span class="tsd-signature-symbol">[]</span><a href="#toggle" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="toggle.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">array</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.toggle.html#toggle.T">T</a><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>source array</p>
|
|
4
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">item</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.toggle.html#toggle.T">T</a></span><div class="tsd-comment tsd-typography"><p>item to toggle</p>
|
|
5
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="index.toggle.html#toggle.T">T</a><span class="tsd-signature-symbol">[]</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/toggle.ts#L8">toggle.ts:8</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>trim | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.trim.html">trim</a></li></ul><h1>Function trim</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Removes given characters from both sides of the string.
|
|
2
|
+
If you want to remove from one side of the string see <a href="index.trimStart.html">trimStart</a> and <a href="index.trimEnd.html">trimEnd</a>.</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">trim</span><span class="hl-1">(</span><span class="hl-7">"abcb"</span><span class="hl-1">, </span><span class="hl-7">"ab"</span><span class="hl-1">); </span><span class="hl-6">// "cb"</span><br/><span class="hl-2">trim</span><span class="hl-1">(</span><span class="hl-7">"!aaa!"</span><span class="hl-1">, </span><span class="hl-7">"!"</span><span class="hl-1">); </span><span class="hl-6">// "aaa"</span><br/><span class="hl-2">trim</span><span class="hl-1">(</span><span class="hl-7">"!aaa!!!"</span><span class="hl-1">, </span><span class="hl-7">"!"</span><span class="hl-1">); </span><span class="hl-6">// "aaa"</span><br/><span class="hl-2">trim</span><span class="hl-1">(</span><span class="hl-7">"!aaa!!!"</span><span class="hl-1">, </span><span class="hl-7">"!!!"</span><span class="hl-1">); </span><span class="hl-6">// "!aaa"</span>
|
|
4
|
+
</code><button type="button">Copy</button></pre>
|
|
5
|
+
|
|
6
|
+
</div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="trim" class="tsd-anchor"></a><span class="tsd-kind-call-signature">trim</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">source</span>, <span class="tsd-kind-parameter">characters</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#trim" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Source string.</p>
|
|
7
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">characters</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Characters to remove, taken as a whole.</p>
|
|
8
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/trim.ts#L17">trim.ts:17</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>trimEnd | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.trimEnd.html">trimEnd</a></li></ul><h1>Function trimEnd</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Removes given characters from the end of the string.
|
|
2
|
+
See also: <a href="index.trim.html">trim</a> and <a href="index.trimStart.html">trimStart</a>.</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">trimEnd</span><span class="hl-1">(</span><span class="hl-7">"abcxzyz"</span><span class="hl-1">, </span><span class="hl-7">"yz"</span><span class="hl-1">); </span><span class="hl-6">// "abcxz"</span><br/><span class="hl-2">trimEnd</span><span class="hl-1">(</span><span class="hl-7">"!aaa!!"</span><span class="hl-1">, </span><span class="hl-7">"!"</span><span class="hl-1">); </span><span class="hl-6">// "!aaa"</span>
|
|
4
|
+
</code><button type="button">Copy</button></pre>
|
|
5
|
+
|
|
6
|
+
</div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="trimEnd" class="tsd-anchor"></a><span class="tsd-kind-call-signature">trim<wbr/>End</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">source</span>, <span class="tsd-kind-parameter">characters</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#trimEnd" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Source string.</p>
|
|
7
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">characters</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Characters to remove, taken as a whole.</p>
|
|
8
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/trimEnd.ts#L12">trimEnd.ts:12</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>trimStart | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.trimStart.html">trimStart</a></li></ul><h1>Function trimStart</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Removes given characters from the start of the string.
|
|
2
|
+
See also: <a href="index.trim.html">trim</a> and <a href="index.trimEnd.html">trimEnd</a>.</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">trimStart</span><span class="hl-1">(</span><span class="hl-7">"abbcb"</span><span class="hl-1">, </span><span class="hl-7">"ab"</span><span class="hl-1">); </span><span class="hl-6">// "bcb"</span><br/><span class="hl-2">trimStart</span><span class="hl-1">(</span><span class="hl-7">"!!aaa!"</span><span class="hl-1">, </span><span class="hl-7">"!"</span><span class="hl-1">); </span><span class="hl-6">// "aaa!"</span>
|
|
4
|
+
</code><button type="button">Copy</button></pre>
|
|
5
|
+
|
|
6
|
+
</div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="trimStart" class="tsd-anchor"></a><span class="tsd-kind-call-signature">trim<wbr/>Start</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">source</span>, <span class="tsd-kind-parameter">characters</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><a href="#trimStart" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Source string.</p>
|
|
7
|
+
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-kind-parameter">characters</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Characters to remove, taken as a whole.</p>
|
|
8
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/trimStart.ts#L12">trimStart.ts:12</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>truthy | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.truthy.html">truthy</a></li></ul><h1>Function truthy</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Returns true if value is truthy, useful with <code>Array.prototype.filter</code> and TypeScript (<code>[].filter(Boolean)</code> won't
|
|
2
|
+
filter out falsy values from the types)</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="truthy" class="tsd-anchor"></a><span class="tsd-kind-call-signature">truthy</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.truthy.html#truthy.T">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">val</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-kind-parameter">val</span><span class="tsd-signature-keyword"> is </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.truthy.html#truthy.T">T</a><a href="#truthy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="truthy.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">val</span>: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">""</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">0</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.truthy.html#truthy.T">T</a></span><div class="tsd-comment tsd-typography"><p>test value</p>
|
|
4
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-kind-parameter">val</span><span class="tsd-signature-keyword"> is </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.truthy.html#truthy.T">T</a></h4><ul>
|
|
5
|
+
<li>is value truthy</li>
|
|
6
|
+
</ul>
|
|
7
|
+
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/truthy.ts#L7">truthy.ts:7</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>unique | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.unique.html">unique</a></li></ul><h1>Function unique</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Returns a new array with unique values of given array.</p>
|
|
2
|
+
</div><div class="tsd-comment tsd-typography"><h4>Example</h4><pre><code class="ts"><span class="hl-2">unique</span><span class="hl-1">([</span><span class="hl-5">1</span><span class="hl-1">, </span><span class="hl-5">2</span><span class="hl-1">, </span><span class="hl-5">3</span><span class="hl-1">, </span><span class="hl-5">2</span><span class="hl-1">, </span><span class="hl-5">1</span><span class="hl-1">]) </span><span class="hl-6">// [1, 2, 3]</span>
|
|
3
|
+
</code><button type="button">Copy</button></pre>
|
|
4
|
+
|
|
5
|
+
</div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="unique" class="tsd-anchor"></a><span class="tsd-kind-call-signature">unique</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.unique.html#unique.T">T</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">arr</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type tsd-kind-type-parameter" href="index.unique.html#unique.T">T</a><a href="#unique" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span><a id="unique.T" class="tsd-anchor"></a><span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-keyword"> extends </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">[]</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">arr</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="index.unique.html#unique.T">T</a></span><div class="tsd-comment tsd-typography"><p>source array</p>
|
|
6
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="index.unique.html#unique.T">T</a></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/unique.ts#L6">unique.ts:6</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>wait | @ezez/utils - v4.1.0</title><meta name="description" content="Documentation for @ezez/utils"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@ezez/utils - v4.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">@ezez/utils</a></li><li><a href="../modules/index.html">index</a></li><li><a href="index.wait.html">wait</a></li></ul><h1>Function wait</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Returns a promise that resolves after given time</p>
|
|
2
|
+
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="wait" class="tsd-anchor"></a><span class="tsd-kind-call-signature">wait</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">timeMs</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span><a href="#wait" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">timeMs</span>: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0</span></span><div class="tsd-comment tsd-typography"><p>time to wait</p>
|
|
3
|
+
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/dzek69/bottom-line/blob/e3307393551770c659e984ef501ad00f2839ca27/src/wait.ts#L6">wait.ts:6</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>@ezez/utils - v4.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|