@studiometa/js-toolkit 3.0.0-beta.2 → 3.0.0-beta.3
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/Base/managers/EventsManager.js +1 -1
- package/Base/managers/EventsManager.js.map +2 -2
- package/decorators/index.d.ts +1 -0
- package/decorators/index.js +1 -0
- package/decorators/index.js.map +2 -2
- package/decorators/withBreakpointObserver.js +0 -2
- package/decorators/withBreakpointObserver.js.map +2 -2
- package/decorators/withDrag.js +1 -1
- package/decorators/withDrag.js.map +2 -2
- package/decorators/withIntersectionObserver.js +0 -2
- package/decorators/withIntersectionObserver.js.map +2 -2
- package/decorators/withMountOnMediaQuery.js +0 -2
- package/decorators/withMountOnMediaQuery.js.map +2 -2
- package/decorators/withMountWhenInView.js +0 -2
- package/decorators/withMountWhenInView.js.map +2 -2
- package/decorators/withMutation.d.ts +13 -0
- package/decorators/withMutation.js +34 -0
- package/decorators/withMutation.js.map +7 -0
- package/decorators/withRelativePointer.js +1 -1
- package/decorators/withRelativePointer.js.map +2 -2
- package/decorators/withScrolledInView/withScrolledInView.js +1 -1
- package/decorators/withScrolledInView/withScrolledInView.js.map +2 -2
- package/helpers/createApp.d.ts +1 -1
- package/helpers/createApp.js +20 -1
- package/helpers/createApp.js.map +2 -2
- package/helpers/getClosestParent.d.ts +1 -1
- package/helpers/getClosestParent.js +2 -2
- package/helpers/getClosestParent.js.map +2 -2
- package/helpers/getInstanceFromElement.d.ts +1 -1
- package/helpers/getInstanceFromElement.js +1 -1
- package/helpers/getInstanceFromElement.js.map +2 -2
- package/helpers/importOnInteraction.d.ts +1 -1
- package/helpers/importOnInteraction.js +1 -1
- package/helpers/importOnInteraction.js.map +2 -2
- package/helpers/importOnMediaQuery.d.ts +1 -1
- package/helpers/importOnMediaQuery.js +1 -1
- package/helpers/importOnMediaQuery.js.map +2 -2
- package/helpers/importWhenIdle.d.ts +1 -1
- package/helpers/importWhenIdle.js +1 -1
- package/helpers/importWhenIdle.js.map +2 -2
- package/helpers/importWhenPrefersMotion.d.ts +1 -1
- package/helpers/importWhenPrefersMotion.js +2 -2
- package/helpers/importWhenPrefersMotion.js.map +2 -2
- package/helpers/importWhenVisible.d.ts +1 -1
- package/helpers/importWhenVisible.js +1 -1
- package/helpers/importWhenVisible.js.map +2 -2
- package/helpers/index.d.ts +8 -8
- package/helpers/index.js +8 -18
- package/helpers/index.js.map +3 -3
- package/package.json +1 -1
- package/services/AbstractService.d.ts +9 -9
- package/services/AbstractService.js +10 -10
- package/services/AbstractService.js.map +3 -3
- package/services/DragService.js +5 -1
- package/services/DragService.js.map +2 -2
- package/services/KeyService.js +1 -1
- package/services/KeyService.js.map +2 -2
- package/services/MutationService.d.ts +20 -0
- package/services/MutationService.js +34 -0
- package/services/MutationService.js.map +7 -0
- package/services/PointerService.js +1 -1
- package/services/PointerService.js.map +2 -2
- package/services/ResizeService.js +2 -2
- package/services/ResizeService.js.map +2 -2
- package/services/ScrollService.js +1 -1
- package/services/ScrollService.js.map +2 -2
- package/services/index.d.ts +1 -0
- package/services/index.js +1 -0
- package/services/index.js.map +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/cache.d.ts +4 -0
- package/utils/cache.js +18 -0
- package/utils/cache.js.map +7 -0
- package/utils/collide/boundingRectToCircle.d.ts +1 -1
- package/utils/collide/boundingRectToCircle.js +1 -1
- package/utils/collide/boundingRectToCircle.js.map +2 -2
- package/utils/collide/collideCircleCircle.d.ts +1 -1
- package/utils/collide/collideCircleCircle.js +1 -1
- package/utils/collide/collideCircleCircle.js.map +2 -2
- package/utils/collide/collideCircleRect.d.ts +1 -1
- package/utils/collide/collideCircleRect.js +1 -1
- package/utils/collide/collideCircleRect.js.map +2 -2
- package/utils/collide/collidePointCircle.d.ts +1 -1
- package/utils/collide/collidePointCircle.js +1 -1
- package/utils/collide/collidePointCircle.js.map +2 -2
- package/utils/collide/collidePointRect.d.ts +1 -1
- package/utils/collide/collidePointRect.js +1 -1
- package/utils/collide/collidePointRect.js.map +2 -2
- package/utils/collide/collideRectRect.d.ts +1 -1
- package/utils/collide/collideRectRect.js +1 -1
- package/utils/collide/collideRectRect.js.map +2 -2
- package/utils/collide/index.d.ts +6 -6
- package/utils/collide/index.js +12 -12
- package/utils/collide/index.js.map +3 -3
- package/utils/css/animate.js.map +2 -2
- package/utils/css/getOffsetSizes.d.ts +1 -1
- package/utils/css/getOffsetSizes.js +1 -1
- package/utils/css/getOffsetSizes.js.map +2 -2
- package/utils/css/index.d.ts +3 -3
- package/utils/css/index.js +6 -6
- package/utils/css/index.js.map +3 -3
- package/utils/css/matrix.d.ts +1 -1
- package/utils/css/matrix.js +1 -1
- package/utils/css/matrix.js.map +2 -2
- package/utils/css/transition.d.ts +1 -1
- package/utils/css/transition.js +2 -2
- package/utils/css/transition.js.map +2 -2
- package/utils/debounce.d.ts +1 -1
- package/utils/debounce.js +1 -1
- package/utils/debounce.js.map +2 -2
- package/utils/dom/createElement.d.ts +10 -0
- package/utils/dom/createElement.js +21 -0
- package/utils/dom/createElement.js.map +7 -0
- package/utils/dom/index.d.ts +1 -0
- package/utils/dom/index.js +1 -0
- package/utils/dom/index.js.map +2 -2
- package/utils/getComponentResolver.d.ts +1 -1
- package/utils/getComponentResolver.js +1 -1
- package/utils/getComponentResolver.js.map +2 -2
- package/utils/index.d.ts +6 -5
- package/utils/index.js +11 -10
- package/utils/index.js.map +3 -3
- package/utils/keyCodes.d.ts +1 -2
- package/utils/keyCodes.js +2 -2
- package/utils/keyCodes.js.map +2 -2
- package/utils/math/clamp.d.ts +1 -1
- package/utils/math/clamp.js +1 -1
- package/utils/math/clamp.js.map +2 -2
- package/utils/math/clamp01.d.ts +1 -1
- package/utils/math/clamp01.js +2 -2
- package/utils/math/clamp01.js.map +2 -2
- package/utils/math/damp.d.ts +1 -1
- package/utils/math/damp.js +1 -1
- package/utils/math/damp.js.map +2 -2
- package/utils/math/index.d.ts +7 -7
- package/utils/math/index.js +14 -14
- package/utils/math/index.js.map +3 -3
- package/utils/math/inertiaFinalValue.d.ts +1 -1
- package/utils/math/inertiaFinalValue.js +2 -2
- package/utils/math/inertiaFinalValue.js.map +2 -2
- package/utils/math/lerp.d.ts +1 -1
- package/utils/math/lerp.js +1 -1
- package/utils/math/lerp.js.map +2 -2
- package/utils/math/map.d.ts +1 -1
- package/utils/math/map.js +1 -1
- package/utils/math/map.js.map +2 -2
- package/utils/math/round.d.ts +1 -1
- package/utils/math/round.js +1 -1
- package/utils/math/round.js.map +2 -2
- package/utils/memoize.d.ts +1 -1
- package/utils/memoize.js +1 -1
- package/utils/memoize.js.map +2 -2
- package/utils/object/getAllProperties.d.ts +1 -1
- package/utils/object/getAllProperties.js +1 -1
- package/utils/object/getAllProperties.js.map +2 -2
- package/utils/string/index.d.ts +10 -10
- package/utils/string/index.js +10 -22
- package/utils/string/index.js.map +3 -3
- package/utils/string/withLeadingCharacters.d.ts +1 -1
- package/utils/string/withLeadingCharacters.js +2 -2
- package/utils/string/withLeadingCharacters.js.map +2 -2
- package/utils/string/withLeadingSlash.d.ts +1 -1
- package/utils/string/withLeadingSlash.js +2 -2
- package/utils/string/withLeadingSlash.js.map +2 -2
- package/utils/string/withTrailingCharacters.d.ts +1 -1
- package/utils/string/withTrailingCharacters.js +2 -2
- package/utils/string/withTrailingCharacters.js.map +2 -2
- package/utils/string/withTrailingSlash.d.ts +1 -1
- package/utils/string/withTrailingSlash.js +2 -2
- package/utils/string/withTrailingSlash.js.map +2 -2
- package/utils/string/withoutLeadingCharacters.d.ts +1 -1
- package/utils/string/withoutLeadingCharacters.js +1 -1
- package/utils/string/withoutLeadingCharacters.js.map +2 -2
- package/utils/string/withoutLeadingCharactersRecursive.d.ts +1 -1
- package/utils/string/withoutLeadingCharactersRecursive.js +2 -2
- package/utils/string/withoutLeadingCharactersRecursive.js.map +2 -2
- package/utils/string/withoutLeadingSlash.d.ts +1 -1
- package/utils/string/withoutLeadingSlash.js +2 -2
- package/utils/string/withoutLeadingSlash.js.map +2 -2
- package/utils/string/withoutTrailingCharacters.d.ts +1 -1
- package/utils/string/withoutTrailingCharacters.js +1 -1
- package/utils/string/withoutTrailingCharacters.js.map +2 -2
- package/utils/string/withoutTrailingCharactersRecursive.d.ts +1 -1
- package/utils/string/withoutTrailingCharactersRecursive.js +2 -2
- package/utils/string/withoutTrailingCharactersRecursive.js.map +2 -2
- package/utils/string/withoutTrailingSlash.d.ts +1 -1
- package/utils/string/withoutTrailingSlash.js +2 -2
- package/utils/string/withoutTrailingSlash.js.map +2 -2
- package/utils/throttle.d.ts +1 -1
- package/utils/throttle.js +1 -1
- package/utils/throttle.js.map +2 -2
- package/utils/trapFocus.js +1 -1
- package/utils/trapFocus.js.map +2 -2
package/utils/math/damp.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/math/damp.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Get the next damped value for a given factor.\n *\n * @param {number} targetValue The final value.\n * @param {number} currentValue The current value.\n * @param {number} [factor=0.5] The factor used to reach the target value.\n * @param {number} [precision=0.01] The precision used to calculate the latest value.\n * @returns {number} The next value.\n */\nexport
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * Get the next damped value for a given factor.\n *\n * @param {number} targetValue The final value.\n * @param {number} currentValue The current value.\n * @param {number} [factor=0.5] The factor used to reach the target value.\n * @param {number} [precision=0.01] The precision used to calculate the latest value.\n * @returns {number} The next value.\n */\nexport function damp(\n targetValue: number,\n currentValue: number,\n factor = 0.5,\n precision = 0.01,\n) {\n return Math.abs(targetValue - currentValue) < precision\n ? targetValue\n : currentValue + (targetValue - currentValue) * factor;\n}\n"],
|
|
5
|
+
"mappings": "AASO,SAAS,KACd,aACA,cACA,SAAS,KACT,YAAY,MACZ;AACA,SAAO,KAAK,IAAI,cAAc,YAAY,IAAI,YAC1C,cACA,gBAAgB,cAAc,gBAAgB;AACpD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ export * as ease from './ease.js';
|
|
|
2
2
|
export * from './createEases.js';
|
|
3
3
|
export * from './ease.js';
|
|
4
4
|
export { createRange } from './createRange.js';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
5
|
+
export { clamp } from './clamp.js';
|
|
6
|
+
export { clamp01 } from './clamp01.js';
|
|
7
|
+
export { damp } from './damp.js';
|
|
8
|
+
export { inertiaFinalValue } from './inertiaFinalValue.js';
|
|
9
|
+
export { lerp } from './lerp.js';
|
|
10
|
+
export { map } from './map.js';
|
|
11
|
+
export { round } from './round.js';
|
|
12
12
|
export { mean } from './mean.js';
|
package/utils/math/index.js
CHANGED
|
@@ -2,24 +2,24 @@ import * as ease from "./ease.js";
|
|
|
2
2
|
export * from "./createEases.js";
|
|
3
3
|
export * from "./ease.js";
|
|
4
4
|
import { createRange } from "./createRange.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
5
|
+
import { clamp } from "./clamp.js";
|
|
6
|
+
import { clamp01 } from "./clamp01.js";
|
|
7
|
+
import { damp } from "./damp.js";
|
|
8
|
+
import { inertiaFinalValue } from "./inertiaFinalValue.js";
|
|
9
|
+
import { lerp } from "./lerp.js";
|
|
10
|
+
import { map } from "./map.js";
|
|
11
|
+
import { round } from "./round.js";
|
|
12
12
|
import { mean } from "./mean.js";
|
|
13
13
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
clamp,
|
|
15
|
+
clamp01,
|
|
16
16
|
createRange,
|
|
17
|
-
|
|
17
|
+
damp,
|
|
18
18
|
ease,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
inertiaFinalValue,
|
|
20
|
+
lerp,
|
|
21
|
+
map,
|
|
22
22
|
mean,
|
|
23
|
-
|
|
23
|
+
round
|
|
24
24
|
};
|
|
25
25
|
//# sourceMappingURL=index.js.map
|
package/utils/math/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/math/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * as ease from './ease.js';\nexport * from './createEases.js';\nexport * from './ease.js';\nexport { createRange } from './createRange.js';\nexport {
|
|
5
|
-
"mappings": "AAAA,YAAY,UAAU;AACtB,cAAc;AACd,cAAc;AACd,SAAS,mBAAmB;AAC5B,
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["export * as ease from './ease.js';\nexport * from './createEases.js';\nexport * from './ease.js';\nexport { createRange } from './createRange.js';\nexport { clamp } from './clamp.js';\nexport { clamp01 } from './clamp01.js';\nexport { damp } from './damp.js';\nexport { inertiaFinalValue } from './inertiaFinalValue.js';\nexport { lerp } from './lerp.js';\nexport { map } from './map.js';\nexport { round } from './round.js';\nexport { mean } from './mean.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,UAAU;AACtB,cAAc;AACd,cAAc;AACd,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,yBAAyB;AAClC,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,SAAS,aAAa;AACtB,SAAS,YAAY;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* @param {number} [dampFactor=0.85] The speed to reach the target value.
|
|
7
7
|
* @returns {number} The next value.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare function inertiaFinalValue(initialValue: number, initialDelta: number, dampFactor?: number): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import clamp from "./clamp.js";
|
|
1
|
+
import { clamp } from "./clamp.js";
|
|
2
2
|
function inertiaFinalValue(initialValue, initialDelta, dampFactor = 0.85) {
|
|
3
3
|
dampFactor = clamp(dampFactor, 1e-5, 0.99999);
|
|
4
4
|
let delta = initialDelta;
|
|
@@ -10,6 +10,6 @@ function inertiaFinalValue(initialValue, initialDelta, dampFactor = 0.85) {
|
|
|
10
10
|
return finalValue;
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
|
-
inertiaFinalValue
|
|
13
|
+
inertiaFinalValue
|
|
14
14
|
};
|
|
15
15
|
//# sourceMappingURL=inertiaFinalValue.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/math/inertiaFinalValue.ts"],
|
|
4
|
-
"sourcesContent": ["import clamp from './clamp.js';\n\n/**\n * Get the final damped value for a given factor.\n *\n * @param {number} initialValue The final value.\n * @param {number} initialDelta The current value.\n * @param {number} [dampFactor=0.85] The speed to reach the target value.\n * @returns {number} The next value.\n */\nexport
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { clamp } from './clamp.js';\n\n/**\n * Get the final damped value for a given factor.\n *\n * @param {number} initialValue The final value.\n * @param {number} initialDelta The current value.\n * @param {number} [dampFactor=0.85] The speed to reach the target value.\n * @returns {number} The next value.\n */\nexport function inertiaFinalValue(initialValue: number, initialDelta: number, dampFactor = 0.85) {\n // eslint-disable-next-line no-param-reassign\n dampFactor = clamp(dampFactor, 0.00001, 0.99999);\n let delta = initialDelta;\n let finalValue = initialValue;\n\n while (Math.abs(delta) > 0.1) {\n finalValue += delta;\n delta *= dampFactor;\n }\n\n return finalValue;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,aAAa;AAUf,SAAS,kBAAkB,cAAsB,cAAsB,aAAa,MAAM;AAE/F,eAAa,MAAM,YAAY,MAAS,OAAO;AAC/C,MAAI,QAAQ;AACZ,MAAI,aAAa;AAEjB,SAAO,KAAK,IAAI,KAAK,IAAI,KAAK;AAC5B,kBAAc;AACd,aAAS;AAAA,EACX;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/lerp.d.ts
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* @param {number} ratio The ratio to get.
|
|
7
7
|
* @returns {number} The value between min and max corresponding to ratio.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare function lerp(min: number, max: number, ratio: number): number;
|
package/utils/math/lerp.js
CHANGED
package/utils/math/lerp.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/math/lerp.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport function lerp(min: number, max: number, ratio: number) {\n return (1 - ratio) * min + ratio * max;\n}\n"],
|
|
5
|
+
"mappings": "AAQO,SAAS,KAAK,KAAa,KAAa,OAAe;AAC5D,UAAQ,IAAI,SAAS,MAAM,QAAQ;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/map.d.ts
CHANGED
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* @param {number} outputMax The output's maximum value.
|
|
9
9
|
* @returns {number} The input value mapped to the output range.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export declare function map(value: number, inputMin: number, inputMax: number, outputMin: number, outputMax: number): number;
|
package/utils/math/map.js
CHANGED
package/utils/math/map.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/math/map.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport function map(\n value: number,\n inputMin: number,\n inputMax: number,\n outputMin: number,\n outputMax: number,\n) {\n return ((value - inputMin) * (outputMax - outputMin)) / (inputMax - inputMin) + outputMin;\n}\n"],
|
|
5
|
+
"mappings": "AAUO,SAAS,IACd,OACA,UACA,UACA,WACA,WACA;AACA,UAAS,QAAQ,aAAa,YAAY,cAAe,WAAW,YAAY;AAClF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/round.d.ts
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param {number} [decimals=0] The number of decimals to keep.
|
|
6
6
|
* @returns {number} A rounded number to the given decimals length.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function round(value: number, decimals?: number): number;
|
package/utils/math/round.js
CHANGED
package/utils/math/round.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/math/round.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport function round(value: number, decimals = 0) {\n return Number(value.toFixed(decimals));\n}\n"],
|
|
5
|
+
"mappings": "AAOO,SAAS,MAAM,OAAe,WAAW,GAAG;AACjD,SAAO,OAAO,MAAM,QAAQ,QAAQ,CAAC;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/memoize.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ export interface MemoizeOptions<T> {
|
|
|
17
17
|
/**
|
|
18
18
|
* Memoize the output of a function.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export declare function memoize<T extends (...args: unknown[]) => unknown>(fn: T, { maxAge, cacheKey, cache, }?: MemoizeOptions<ReturnType<T>>): (...args: Parameters<T>) => ReturnType<T>;
|
package/utils/memoize.js
CHANGED
package/utils/memoize.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../packages/js-toolkit/utils/memoize.ts"],
|
|
4
|
-
"sourcesContent": ["export interface MemoizeCache<T> {\n has: (key: unknown) => boolean;\n set: (key: unknown, value: { data: T; date: number }) => this;\n get: (key: unknown) => { data: T; date: number };\n}\n\nexport interface MemoizeOptions<T> {\n maxAge?: number;\n cacheKey?: (args: unknown[]) => string;\n cache?: MemoizeCache<T>;\n}\n\n/**\n * Memoize the output of a function.\n */\nexport
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export interface MemoizeCache<T> {\n has: (key: unknown) => boolean;\n set: (key: unknown, value: { data: T; date: number }) => this;\n get: (key: unknown) => { data: T; date: number };\n}\n\nexport interface MemoizeOptions<T> {\n maxAge?: number;\n cacheKey?: (args: unknown[]) => string;\n cache?: MemoizeCache<T>;\n}\n\n/**\n * Memoize the output of a function.\n */\nexport function memoize<T extends (...args: unknown[]) => unknown>(\n fn: T,\n {\n maxAge = Number.POSITIVE_INFINITY,\n cacheKey = JSON.stringify,\n cache = new Map(),\n }: MemoizeOptions<ReturnType<T>> = {},\n): (...args: Parameters<T>) => ReturnType<T> {\n return function memoized(...args): ReturnType<T> {\n const key = cacheKey(args);\n const date = Date.now();\n\n if (cache.has(key)) {\n const cached = cache.get(key);\n\n if (date - cached.date < maxAge) {\n return cached.data;\n }\n }\n\n // @ts-ignore\n const data: ReturnType<T> = fn(...args);\n\n cache.set(key, {\n data,\n date: Date.now(),\n });\n\n return data;\n };\n}\n"],
|
|
5
|
+
"mappings": "AAeO,SAAS,QACd,IACA;AAAA,EACE,SAAS,OAAO;AAAA,EAChB,WAAW,KAAK;AAAA,EAChB,QAAQ,oBAAI,IAAI;AAClB,IAAmC,CAAC,GACO;AAC3C,SAAO,SAAS,YAAY,MAAqB;AAC/C,UAAM,MAAM,SAAS,IAAI;AACzB,UAAM,OAAO,KAAK,IAAI;AAEtB,QAAI,MAAM,IAAI,GAAG,GAAG;AAClB,YAAM,SAAS,MAAM,IAAI,GAAG;AAE5B,UAAI,OAAO,OAAO,OAAO,QAAQ;AAC/B,eAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAGA,UAAM,OAAsB,GAAG,GAAG,IAAI;AAEtC,UAAM,IAAI,KAAK;AAAA,MACb;AAAA,MACA,MAAM,KAAK,IAAI;AAAA,IACjB,CAAC;AAED,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
* @param {(name:string, proto:any) => boolean} testFn
|
|
9
9
|
* @returns {Array<[string, Object]>} An array of properties and the prototype they belong to.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export declare function getAllProperties(object: unknown, props?: Array<[string, unknown]>, testFn?: (name: string, proto: unknown) => boolean): Array<[string, unknown]>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/object/getAllProperties.ts"],
|
|
4
|
-
"sourcesContent": ["import { isFunction } from '../is.js';\n\n/**\n * Gets all non-builtin properties up the prototype chain.\n *\n * @param {Object} object\n * The object to get the propeties from.\n * @param {Array} [props=[]]\n * The already existing properties.\n * @param {(name:string, proto:any) => boolean} testFn\n * @returns {Array<[string, Object]>} An array of properties and the prototype they belong to.\n */\nexport
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;
|
|
4
|
+
"sourcesContent": ["import { isFunction } from '../is.js';\n\n/**\n * Gets all non-builtin properties up the prototype chain.\n *\n * @param {Object} object\n * The object to get the propeties from.\n * @param {Array} [props=[]]\n * The already existing properties.\n * @param {(name:string, proto:any) => boolean} testFn\n * @returns {Array<[string, Object]>} An array of properties and the prototype they belong to.\n */\nexport function getAllProperties(\n object: unknown,\n props: Array<[string, unknown]> = [],\n testFn: (name: string, proto: unknown) => boolean = null,\n): Array<[string, unknown]> {\n const proto = Object.getPrototypeOf(object);\n\n if (proto === Object.prototype || proto === null) {\n return props;\n }\n\n let foundProps = Object.getOwnPropertyNames(proto);\n\n if (isFunction(testFn)) {\n foundProps = foundProps.filter((name) => testFn(name, proto));\n }\n\n const formatedProps = foundProps\n .map<[string, unknown]>((name) => [name, proto])\n .reduce<Array<[string, unknown]>>((acc, val) => [...acc, val], props);\n\n return getAllProperties(proto, formatedProps, testFn);\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAYpB,SAAS,iBACd,QACA,QAAkC,CAAC,GACnC,SAAoD,MAC1B;AAC1B,QAAM,QAAQ,OAAO,eAAe,MAAM;AAE1C,MAAI,UAAU,OAAO,aAAa,UAAU,MAAM;AAChD,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,OAAO,oBAAoB,KAAK;AAEjD,MAAI,WAAW,MAAM,GAAG;AACtB,iBAAa,WAAW,OAAO,CAAC,SAAS,OAAO,MAAM,KAAK,CAAC;AAAA,EAC9D;AAEA,QAAM,gBAAgB,WACnB,IAAuB,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAC9C,OAAiC,CAAC,KAAK,QAAQ,CAAC,GAAG,KAAK,GAAG,GAAG,KAAK;AAEtE,SAAO,iBAAiB,OAAO,eAAe,MAAM;AACtD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/string/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
1
|
+
export * from './withLeadingCharacters.js';
|
|
2
|
+
export * from './withLeadingSlash.js';
|
|
3
|
+
export * from './withoutLeadingCharacters.js';
|
|
4
|
+
export * from './withoutLeadingCharactersRecursive.js';
|
|
5
|
+
export * from './withoutLeadingSlash.js';
|
|
6
|
+
export * from './withoutTrailingCharacters.js';
|
|
7
|
+
export * from './withoutTrailingCharactersRecursive.js';
|
|
8
|
+
export * from './withoutTrailingSlash.js';
|
|
9
|
+
export * from './withTrailingCharacters.js';
|
|
10
|
+
export * from './withTrailingSlash.js';
|
|
11
11
|
export * from './startsWith.js';
|
|
12
12
|
export * from './endsWith.js';
|
|
13
13
|
export * from './changeCase.js';
|
package/utils/string/index.js
CHANGED
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
export * from "./withLeadingCharacters.js";
|
|
2
|
+
export * from "./withLeadingSlash.js";
|
|
3
|
+
export * from "./withoutLeadingCharacters.js";
|
|
4
|
+
export * from "./withoutLeadingCharactersRecursive.js";
|
|
5
|
+
export * from "./withoutLeadingSlash.js";
|
|
6
|
+
export * from "./withoutTrailingCharacters.js";
|
|
7
|
+
export * from "./withoutTrailingCharactersRecursive.js";
|
|
8
|
+
export * from "./withoutTrailingSlash.js";
|
|
9
|
+
export * from "./withTrailingCharacters.js";
|
|
10
|
+
export * from "./withTrailingSlash.js";
|
|
11
11
|
export * from "./startsWith.js";
|
|
12
12
|
export * from "./endsWith.js";
|
|
13
13
|
export * from "./changeCase.js";
|
|
14
|
-
export {
|
|
15
|
-
default2 as withLeadingCharacters,
|
|
16
|
-
default3 as withLeadingSlash,
|
|
17
|
-
default10 as withTrailingCharacters,
|
|
18
|
-
default11 as withTrailingSlash,
|
|
19
|
-
default4 as withoutLeadingCharacters,
|
|
20
|
-
default5 as withoutLeadingCharactersRecursive,
|
|
21
|
-
default6 as withoutLeadingSlash,
|
|
22
|
-
default7 as withoutTrailingCharacters,
|
|
23
|
-
default8 as withoutTrailingCharactersRecursive,
|
|
24
|
-
default9 as withoutTrailingSlash
|
|
25
|
-
};
|
|
26
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/string/index.ts"],
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["export * from './withLeadingCharacters.js';\nexport * from './withLeadingSlash.js';\nexport * from './withoutLeadingCharacters.js';\nexport * from './withoutLeadingCharactersRecursive.js';\nexport * from './withoutLeadingSlash.js';\nexport * from './withoutTrailingCharacters.js';\nexport * from './withoutTrailingCharactersRecursive.js';\nexport * from './withoutTrailingSlash.js';\nexport * from './withTrailingCharacters.js';\nexport * from './withTrailingSlash.js';\nexport * from './startsWith.js';\nexport * from './endsWith.js';\nexport * from './changeCase.js';\n"],
|
|
5
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param {string} characters The characters to add to the start.
|
|
6
6
|
* @returns {string}
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function withLeadingCharacters(string: string, characters: string): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import withoutLeadingCharacters from "./withoutLeadingCharacters.js";
|
|
1
|
+
import { withoutLeadingCharacters } from "./withoutLeadingCharacters.js";
|
|
2
2
|
function withLeadingCharacters(string, characters) {
|
|
3
3
|
return `${characters}${withoutLeadingCharacters(string, characters)}`;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
withLeadingCharacters
|
|
6
|
+
withLeadingCharacters
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=withLeadingCharacters.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/string/withLeadingCharacters.ts"],
|
|
4
|
-
"sourcesContent": ["import withoutLeadingCharacters from './withoutLeadingCharacters.js';\n\n/**\n * Add the given characters to the start of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the start.\n * @returns {string}\n */\nexport
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { withoutLeadingCharacters } from './withoutLeadingCharacters.js';\n\n/**\n * Add the given characters to the start of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the start.\n * @returns {string}\n */\nexport function withLeadingCharacters(string: string, characters: string): string {\n return `${characters}${withoutLeadingCharacters(string, characters)}`;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gCAAgC;AASlC,SAAS,sBAAsB,QAAgB,YAA4B;AAChF,SAAO,GAAG,UAAU,GAAG,yBAAyB,QAAQ,UAAU,CAAC;AACrE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import withLeadingCharacters from "./withLeadingCharacters.js";
|
|
1
|
+
import { withLeadingCharacters } from "./withLeadingCharacters.js";
|
|
2
2
|
function withLeadingSlash(string) {
|
|
3
3
|
return withLeadingCharacters(string, "/");
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
withLeadingSlash
|
|
6
|
+
withLeadingSlash
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=withLeadingSlash.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/string/withLeadingSlash.ts"],
|
|
4
|
-
"sourcesContent": ["import withLeadingCharacters from './withLeadingCharacters.js';\n\n/**\n * Add a leading slash to a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string with a leading slash.\n */\nexport
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { withLeadingCharacters } from './withLeadingCharacters.js';\n\n/**\n * Add a leading slash to a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string with a leading slash.\n */\nexport function withLeadingSlash(string: string): string {\n return withLeadingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,6BAA6B;AAQ/B,SAAS,iBAAiB,QAAwB;AACvD,SAAO,sBAAsB,QAAQ,GAAG;AAC1C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param {string} characters The characters to add to the end.
|
|
6
6
|
* @returns {string}
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function withTrailingCharacters(string: string, characters: string): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import withoutTrailingCharacters from "./withoutTrailingCharacters.js";
|
|
1
|
+
import { withoutTrailingCharacters } from "./withoutTrailingCharacters.js";
|
|
2
2
|
function withTrailingCharacters(string, characters) {
|
|
3
3
|
return `${withoutTrailingCharacters(string, characters)}${characters}`;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
withTrailingCharacters
|
|
6
|
+
withTrailingCharacters
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=withTrailingCharacters.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/string/withTrailingCharacters.ts"],
|
|
4
|
-
"sourcesContent": ["import withoutTrailingCharacters from './withoutTrailingCharacters.js';\n\n/**\n * Add the given characters to the end of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the end.\n * @returns {string}\n */\nexport
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { withoutTrailingCharacters } from './withoutTrailingCharacters.js';\n\n/**\n * Add the given characters to the end of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the end.\n * @returns {string}\n */\nexport function withTrailingCharacters(string: string, characters: string): string {\n return `${withoutTrailingCharacters(string, characters)}${characters}`;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iCAAiC;AASnC,SAAS,uBAAuB,QAAgB,YAA4B;AACjF,SAAO,GAAG,0BAA0B,QAAQ,UAAU,CAAC,GAAG,UAAU;AACtE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import withTrailingCharacters from "./withTrailingCharacters.js";
|
|
1
|
+
import { withTrailingCharacters } from "./withTrailingCharacters.js";
|
|
2
2
|
function withTrailingSlash(string) {
|
|
3
3
|
return withTrailingCharacters(string, "/");
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
withTrailingSlash
|
|
6
|
+
withTrailingSlash
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=withTrailingSlash.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/string/withTrailingSlash.ts"],
|
|
4
|
-
"sourcesContent": ["import withTrailingCharacters from './withTrailingCharacters.js';\n\n/**\n * Add a trailing slash to a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string with a trailing slash.\n */\nexport
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { withTrailingCharacters } from './withTrailingCharacters.js';\n\n/**\n * Add a trailing slash to a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string with a trailing slash.\n */\nexport function withTrailingSlash(string: string): string {\n return withTrailingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,8BAA8B;AAQhC,SAAS,kBAAkB,QAAwB;AACxD,SAAO,uBAAuB,QAAQ,GAAG;AAC3C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param {string} characters The characters to remove from the start.
|
|
6
6
|
* @returns {string}
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function withoutLeadingCharacters(string: string, characters: string): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingCharacters.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Remove the given characters from the start of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to remove from the start.\n * @returns {string}\n */\nexport
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * Remove the given characters from the start of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to remove from the start.\n * @returns {string}\n */\nexport function withoutLeadingCharacters(string: string, characters: string): string {\n return string.replace(new RegExp(`^${characters}`), '');\n}\n"],
|
|
5
|
+
"mappings": "AAOO,SAAS,yBAAyB,QAAgB,YAA4B;AACnF,SAAO,OAAO,QAAQ,IAAI,OAAO,IAAI,UAAU,EAAE,GAAG,EAAE;AACxD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param {string} characters The characters to add to the start.
|
|
6
6
|
* @returns {string}
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function withoutLeadingCharactersRecursive(string: string, characters: string): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import withoutLeadingCharacters from "./withoutLeadingCharacters.js";
|
|
1
|
+
import { withoutLeadingCharacters } from "./withoutLeadingCharacters.js";
|
|
2
2
|
function withoutLeadingCharactersRecursive(string, characters) {
|
|
3
3
|
let str = withoutLeadingCharacters(string, characters);
|
|
4
4
|
const regex = new RegExp(`^${characters}`);
|
|
@@ -8,6 +8,6 @@ function withoutLeadingCharactersRecursive(string, characters) {
|
|
|
8
8
|
return str;
|
|
9
9
|
}
|
|
10
10
|
export {
|
|
11
|
-
withoutLeadingCharactersRecursive
|
|
11
|
+
withoutLeadingCharactersRecursive
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=withoutLeadingCharactersRecursive.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingCharactersRecursive.ts"],
|
|
4
|
-
"sourcesContent": ["import withoutLeadingCharacters from './withoutLeadingCharacters.js';\n\n/**\n * Remove the given characters to the start of the given string recursively.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the start.\n * @returns {string}\n */\nexport
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { withoutLeadingCharacters } from './withoutLeadingCharacters.js';\n\n/**\n * Remove the given characters to the start of the given string recursively.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the start.\n * @returns {string}\n */\nexport function withoutLeadingCharactersRecursive(string: string, characters: string): string {\n let str = withoutLeadingCharacters(string, characters);\n const regex = new RegExp(`^${characters}`);\n\n while (regex.test(str)) {\n str = withoutLeadingCharacters(str, characters);\n }\n\n return str;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gCAAgC;AASlC,SAAS,kCAAkC,QAAgB,YAA4B;AAC5F,MAAI,MAAM,yBAAyB,QAAQ,UAAU;AACrD,QAAM,QAAQ,IAAI,OAAO,IAAI,UAAU,EAAE;AAEzC,SAAO,MAAM,KAAK,GAAG,GAAG;AACtB,UAAM,yBAAyB,KAAK,UAAU;AAAA,EAChD;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import withoutLeadingCharacters from "./withoutLeadingCharacters.js";
|
|
1
|
+
import { withoutLeadingCharacters } from "./withoutLeadingCharacters.js";
|
|
2
2
|
function withoutLeadingSlash(string) {
|
|
3
3
|
return withoutLeadingCharacters(string, "/");
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
|
-
withoutLeadingSlash
|
|
6
|
+
withoutLeadingSlash
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=withoutLeadingSlash.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingSlash.ts"],
|
|
4
|
-
"sourcesContent": ["import withoutLeadingCharacters from './withoutLeadingCharacters.js';\n\n/**\n * Remove the leading slash from a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string without leading slash.\n */\nexport
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { withoutLeadingCharacters } from './withoutLeadingCharacters.js';\n\n/**\n * Remove the leading slash from a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string without leading slash.\n */\nexport function withoutLeadingSlash(string: string): string {\n return withoutLeadingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gCAAgC;AAQlC,SAAS,oBAAoB,QAAwB;AAC1D,SAAO,yBAAyB,QAAQ,GAAG;AAC7C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param {string} characters The characters to remove from the end.
|
|
6
6
|
* @returns {string}
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare function withoutTrailingCharacters(string: string, characters: string): string;
|