Merge branch 'fix/urlencoded'
This commit is contained in:
@@ -39,3 +39,6 @@ export const arrayFlatMap =
|
||||
<T, U>(mapFunc: (value: T, index: number, arr: T[]) => U[]) =>
|
||||
(arr: T[]) =>
|
||||
arr.flatMap(mapFunc)
|
||||
|
||||
export const stringArrayJoin = (separator: string) => (arr: string[]) =>
|
||||
arr.join(separator)
|
||||
|
||||
9
packages/hoppscotch-app/helpers/functional/debug.ts
Normal file
9
packages/hoppscotch-app/helpers/functional/debug.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Logs the current value and returns the same value
|
||||
* @param x The value to log
|
||||
* @returns The parameter `x` passed to this
|
||||
*/
|
||||
export const trace = <T>(x: T) => {
|
||||
console.log(x)
|
||||
return x
|
||||
}
|
||||
9
packages/hoppscotch-app/helpers/functional/record.ts
Normal file
9
packages/hoppscotch-app/helpers/functional/record.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export const tupleToRecord = <
|
||||
KeyType extends string | number | symbol,
|
||||
ValueType
|
||||
>(
|
||||
tuples: [KeyType, ValueType][]
|
||||
): Record<KeyType, ValueType> =>
|
||||
tuples.length > 0
|
||||
? (Object.assign as any)(...tuples.map(([key, val]) => ({ [key]: val })))
|
||||
: {}
|
||||
Reference in New Issue
Block a user