@ls-stack/utils 3.59.0 → 3.60.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.
@@ -1,6 +1,7 @@
1
1
  import { Result } from 't-result';
2
2
  import { SortByValueFn, SortByProps } from './arrayUtils.cjs';
3
3
  import { MakeUndefinedKeysOptional } from './typeUtils.cjs';
4
+ import { AddPrefixToObjKeys, AddSuffixToObjKeys } from './typingUtils.cjs';
4
5
 
5
6
  /**
6
7
  * @deprecated Use typedObjectEntries from @ls-stack/utils/typingFnUtils instead
@@ -21,11 +22,7 @@ declare function filterObjectKeys<T extends Record<string, unknown>>(obj: T, pre
21
22
  declare function sortObjectKeys<T extends Record<string, unknown>>(obj: T, sortByFn: SortByValueFn<[key: keyof T, value: T[keyof T]]>, options?: SortByProps): T;
22
23
  declare function getValueFromPath(obj: Record<string, unknown>, path: string): Result<unknown, Error>;
23
24
  declare function getObjPropertyOrInsert<T extends Record<string, any>, K extends keyof T>(obj: T, prop: K, insertValue: () => Exclude<T[K], undefined>): Exclude<T[K], undefined>;
24
- declare function addPrefixToObjKeys<T extends Record<string, unknown>, P extends string>(obj: T, prefix: P): {
25
- [K in keyof T & string as `${P}${K}`]: T[K];
26
- };
27
- declare function addSuffixToObjKeys<T extends Record<string, unknown>, S extends string>(obj: T, suffix: S): {
28
- [K in keyof T & string as `${K}${S}`]: T[K];
29
- };
25
+ declare function addPrefixToObjKeys<T extends Record<string, unknown>, P extends string>(obj: T, prefix: P): AddPrefixToObjKeys<T, P>;
26
+ declare function addSuffixToObjKeys<T extends Record<string, unknown>, S extends string>(obj: T, suffix: S): AddSuffixToObjKeys<T, S>;
30
27
 
31
28
  export { addPrefixToObjKeys, addSuffixToObjKeys, filterObjectKeys, getObjPropertyOrInsert, getValueFromPath, looseGetObjectProperty, mapArrToObj, mapArrayToObject, mapObjToObj, mapObjectToObject, objectTypedEntries, omit, pick, rejectObjUndefinedValues, sortObjectKeys };
@@ -1,6 +1,7 @@
1
1
  import { Result } from 't-result';
2
2
  import { SortByValueFn, SortByProps } from './arrayUtils.js';
3
3
  import { MakeUndefinedKeysOptional } from './typeUtils.js';
4
+ import { AddPrefixToObjKeys, AddSuffixToObjKeys } from './typingUtils.js';
4
5
 
5
6
  /**
6
7
  * @deprecated Use typedObjectEntries from @ls-stack/utils/typingFnUtils instead
@@ -21,11 +22,7 @@ declare function filterObjectKeys<T extends Record<string, unknown>>(obj: T, pre
21
22
  declare function sortObjectKeys<T extends Record<string, unknown>>(obj: T, sortByFn: SortByValueFn<[key: keyof T, value: T[keyof T]]>, options?: SortByProps): T;
22
23
  declare function getValueFromPath(obj: Record<string, unknown>, path: string): Result<unknown, Error>;
23
24
  declare function getObjPropertyOrInsert<T extends Record<string, any>, K extends keyof T>(obj: T, prop: K, insertValue: () => Exclude<T[K], undefined>): Exclude<T[K], undefined>;
24
- declare function addPrefixToObjKeys<T extends Record<string, unknown>, P extends string>(obj: T, prefix: P): {
25
- [K in keyof T & string as `${P}${K}`]: T[K];
26
- };
27
- declare function addSuffixToObjKeys<T extends Record<string, unknown>, S extends string>(obj: T, suffix: S): {
28
- [K in keyof T & string as `${K}${S}`]: T[K];
29
- };
25
+ declare function addPrefixToObjKeys<T extends Record<string, unknown>, P extends string>(obj: T, prefix: P): AddPrefixToObjKeys<T, P>;
26
+ declare function addSuffixToObjKeys<T extends Record<string, unknown>, S extends string>(obj: T, suffix: S): AddSuffixToObjKeys<T, S>;
30
27
 
31
28
  export { addPrefixToObjKeys, addSuffixToObjKeys, filterObjectKeys, getObjPropertyOrInsert, getValueFromPath, looseGetObjectProperty, mapArrToObj, mapArrayToObject, mapObjToObj, mapObjectToObject, objectTypedEntries, omit, pick, rejectObjUndefinedValues, sortObjectKeys };
@@ -25,5 +25,11 @@ type Prettify<T extends Record<string, unknown>> = {
25
25
  type DeepPrettify<T> = {
26
26
  [K in keyof T]: T[K] extends Record<string, unknown> ? DeepPrettify<T[K]> : T[K];
27
27
  } & {};
28
+ type AddPrefixToObjKeys<T extends Record<string, unknown>, Prefix extends string> = {
29
+ [K in keyof T & string as `${Prefix}${K}`]: T[K];
30
+ };
31
+ type AddSuffixToObjKeys<T extends Record<string, unknown>, Suffix extends string> = {
32
+ [K in keyof T & string as `${K}${Suffix}`]: T[K];
33
+ };
28
34
 
29
- export type { DeepPrettify, IsAny, NonPartial, ObjKeysWithValuesOfType, PartialRecord, Prettify };
35
+ export type { AddPrefixToObjKeys, AddSuffixToObjKeys, DeepPrettify, IsAny, NonPartial, ObjKeysWithValuesOfType, PartialRecord, Prettify };
@@ -25,5 +25,11 @@ type Prettify<T extends Record<string, unknown>> = {
25
25
  type DeepPrettify<T> = {
26
26
  [K in keyof T]: T[K] extends Record<string, unknown> ? DeepPrettify<T[K]> : T[K];
27
27
  } & {};
28
+ type AddPrefixToObjKeys<T extends Record<string, unknown>, Prefix extends string> = {
29
+ [K in keyof T & string as `${Prefix}${K}`]: T[K];
30
+ };
31
+ type AddSuffixToObjKeys<T extends Record<string, unknown>, Suffix extends string> = {
32
+ [K in keyof T & string as `${K}${Suffix}`]: T[K];
33
+ };
28
34
 
29
- export type { DeepPrettify, IsAny, NonPartial, ObjKeysWithValuesOfType, PartialRecord, Prettify };
35
+ export type { AddPrefixToObjKeys, AddSuffixToObjKeys, DeepPrettify, IsAny, NonPartial, ObjKeysWithValuesOfType, PartialRecord, Prettify };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ls-stack/utils",
3
3
  "description": "Universal TypeScript utilities for browser and Node.js",
4
- "version": "3.59.0",
4
+ "version": "3.60.0",
5
5
  "license": "MIT",
6
6
  "files": [
7
7
  "dist",