feat: allow quoted key/values for escaping characters and trail/lead whitespaces in raw key value pairs (#2578)

This commit is contained in:
Andrew Bastin
2022-08-12 13:53:40 +05:30
committed by GitHub
parent 017cbb5a71
commit c013aa52ac
7 changed files with 392 additions and 80 deletions

View File

@@ -0,0 +1,17 @@
/**
* Modify a record value with a mapping function
* @param name The key to update
* @param func The value to update
* @returns The updated record
*/
export const recordUpdate =
<
X extends {},
K extends keyof X,
R
>(name: K, func: (input: X[K]) => R) =>
(x: X): Omit<X, K> & { [x in K]: R } => ({
...x,
[name]: func(x[name])
})