@h3ravel/support 0.3.0 → 0.4.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/CHANGELOG.md +11 -0
- package/dist/index.cjs +245 -245
- package/dist/index.d.cts +23 -23
- package/dist/index.d.ts +23 -23
- package/dist/index.js +231 -231
- package/package.json +2 -2
- package/src/Contracts/ObjContract.ts +1 -1
- package/src/Helpers/Arr.ts +1 -1
- package/src/Helpers/Obj.ts +4 -4
- package/src/Helpers/Str.ts +1 -1
- package/tests/str.test.ts +7 -0
package/src/Helpers/Obj.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DotFlatten, DotNestedKeys, DotNestedValue, KeysToSnakeCase } from
|
|
1
|
+
import { DotFlatten, DotNestedKeys, DotNestedValue, KeysToSnakeCase } from '../Contracts/ObjContract'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Flattens a nested object into a single-level object
|
|
@@ -116,7 +116,7 @@ export const getValue = <
|
|
|
116
116
|
*/
|
|
117
117
|
export const modObj = <T extends object, R> (
|
|
118
118
|
obj: T,
|
|
119
|
-
callback: (
|
|
119
|
+
callback: (_entry: [keyof T & string, T[keyof T]]) => [string, R]
|
|
120
120
|
): Record<string, R> => {
|
|
121
121
|
return Object.fromEntries(
|
|
122
122
|
Object.entries(obj).map(([key, value]) =>
|
|
@@ -126,11 +126,11 @@ export const modObj = <T extends object, R> (
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
|
|
129
|
-
export function safeDot<T extends Record<string, any>> (
|
|
129
|
+
export function safeDot<T extends Record<string, any>> (_data: T): T
|
|
130
130
|
export function safeDot<
|
|
131
131
|
T extends Record<string, any>,
|
|
132
132
|
K extends DotNestedKeys<T>
|
|
133
|
-
> (
|
|
133
|
+
> (_data: T, _key?: K): DotNestedValue<T, K>
|
|
134
134
|
export function safeDot<
|
|
135
135
|
T extends Record<string, any>,
|
|
136
136
|
K extends DotNestedKeys<T>
|
package/src/Helpers/Str.ts
CHANGED