a looooot
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { anyPass, isEmpty, isNil, reject } from 'ramda';
|
||||
import { anyPass, assocPath, isEmpty, isNil, reject } from 'ramda';
|
||||
|
||||
export function toDots(
|
||||
obj: Record<string, unknown>,
|
||||
@@ -19,6 +19,16 @@ export function toDots(
|
||||
}, {});
|
||||
}
|
||||
|
||||
export function toObject(
|
||||
obj: Record<string, string | undefined>
|
||||
): Record<string, unknown> {
|
||||
let result: Record<string, unknown> = {};
|
||||
Object.entries(obj).forEach(([key, value]) => {
|
||||
result = assocPath(key.split('.'), value, result);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
export const strip = reject(anyPass([isEmpty, isNil]));
|
||||
|
||||
export function getSafeJson<T>(str: string): T | null {
|
||||
|
||||
Reference in New Issue
Block a user