@revolugo/common 6.10.5 → 6.10.6-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revolugo/common",
3
- "version": "6.10.5",
3
+ "version": "6.10.6-beta.0",
4
4
  "private": false,
5
5
  "description": "Revolugo common",
6
6
  "author": "Revolugo",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "change-case": "5.4.4",
27
27
  "dayjs": "1.11.18",
28
- "ky": "1.10.0",
28
+ "ky": "1.11.0",
29
29
  "lodash-es": "4.17.21",
30
30
  "slugify": "1.6.6",
31
31
  "uuid": "13.0.0"
@@ -20,3 +20,4 @@ export type * from './hotel.ts'
20
20
  export * from './hotel-offer.ts'
21
21
  export * from './contact-person.ts'
22
22
  export type * from './hotel-review-rating.ts'
23
+ export type * from './travel-times.ts'
@@ -0,0 +1,4 @@
1
+ export interface GeoCoordinates {
2
+ latitude: number
3
+ longitude: number
4
+ }
@@ -6,6 +6,7 @@ export type * from './country.ts'
6
6
  export type * from './currency.ts'
7
7
  export type * from './date.ts'
8
8
  export type * from './event.ts'
9
+ export type * from './geo-coordinates.ts'
9
10
  export type * from './hotel-contract.ts'
10
11
  export type * from './hotel-room-stock.ts'
11
12
  export type * from './money-object.ts'
@@ -124,3 +124,43 @@ export function omitBy<T extends object>(
124
124
 
125
125
  return result
126
126
  }
127
+
128
+ /**
129
+ * Creates a shallow clone of `object` excluding the given own enumerable keys.
130
+ * Accepts a single key or an array of keys. Symbol keys are supported.
131
+ * If `object` is nullish, returns an empty object.
132
+ */
133
+ export function omit<T extends object, K extends keyof T>(
134
+ object: T | null | undefined,
135
+ keys: readonly K[] | K,
136
+ ): Omit<T, K> {
137
+ if (object === null || object === undefined) {
138
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
139
+ return {} as any
140
+ }
141
+
142
+ const keysArray = (
143
+ Array.isArray(keys) ? keys : [keys]
144
+ ) as readonly (keyof T)[]
145
+ const keysSet = new Set<keyof T>(keysArray as (keyof T)[])
146
+
147
+ const result: Partial<T> = {}
148
+
149
+ // Copy string/number keys
150
+ for (const key in object) {
151
+ if (Object.hasOwn(object, key) && !keysSet.has(key as keyof T)) {
152
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
153
+ ;(result as any)[key] = object[key as keyof T]
154
+ }
155
+ }
156
+
157
+ // Copy symbol keys
158
+ for (const sym of Object.getOwnPropertySymbols(object)) {
159
+ if (!keysSet.has(sym as keyof T)) {
160
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
161
+ ;(result as any)[sym as unknown as keyof T] = (object as any)[sym]
162
+ }
163
+ }
164
+
165
+ return result as Omit<T, K>
166
+ }
@@ -160,18 +160,17 @@ export class Poller<V extends IPollerResponse> {
160
160
  }
161
161
 
162
162
  private buildPollerOptions(options: TOptions<V>): TOptions<V> {
163
- const compactedOptions = Object.entries(options).reduce<TOptions<V>>(
164
- (acc, [key, value]) => {
165
- if (value !== undefined) {
166
- const tKey = key as keyof TOptions<V>
167
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
168
- acc[tKey] = value as any
169
- }
170
-
171
- return acc
172
- },
173
- {},
174
- )
163
+ const compactedOptions = Object.entries(options).reduce<
164
+ Record<string, unknown>
165
+ >((acc, [key, value]) => {
166
+ if (value !== undefined) {
167
+ const tKey = key as keyof TOptions<V>
168
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
169
+ acc[tKey] = value as any
170
+ }
171
+
172
+ return acc
173
+ }, {}) as TOptions<V>
175
174
 
176
175
  return {
177
176
  ...this.defaultOptions,