@tmlmobilidade/utils 20260306.1635.15 → 20260308.1313.9
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/dist/get-public-trip-id.d.ts +7 -0
- package/dist/get-public-trip-id.js +18 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the public trip ID for a given plan ID and trip ID.
|
|
3
|
+
* @param planId The ID of the plan this trip belongs to.
|
|
4
|
+
* @param tripId The ID of the trip.
|
|
5
|
+
* @returns The public trip ID.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPublicTripId(planId: string, tripId: string): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the public trip ID for a given plan ID and trip ID.
|
|
3
|
+
* @param planId The ID of the plan this trip belongs to.
|
|
4
|
+
* @param tripId The ID of the trip.
|
|
5
|
+
* @returns The public trip ID.
|
|
6
|
+
*/
|
|
7
|
+
export function getPublicTripId(planId, tripId) {
|
|
8
|
+
// Validate that the plan ID is a non-empty string
|
|
9
|
+
if (typeof planId !== 'string' || !planId.trim()) {
|
|
10
|
+
throw new Error('Invalid plan ID: must be a non-empty string.');
|
|
11
|
+
}
|
|
12
|
+
// Validate that the trip ID is a non-empty string
|
|
13
|
+
if (typeof tripId !== 'string' || !tripId.trim()) {
|
|
14
|
+
throw new Error('Invalid trip ID: must be a non-empty string.');
|
|
15
|
+
}
|
|
16
|
+
// Construct the public trip ID using a consistent format
|
|
17
|
+
return `[${planId}]${tripId}`;
|
|
18
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED