Merge branch 'fix/urlencoded'

This commit is contained in:
liyasthomas
2022-01-24 10:09:31 +05:30
15 changed files with 1177 additions and 372 deletions

View File

@@ -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)

View 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
}

View 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 })))
: {}