ag-common 0.0.662 → 0.0.663

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.
@@ -48,7 +48,9 @@ joinKeys: string): string;
48
48
  */
49
49
  export declare const castObject: <TIn, TOut>(orig: Record<string, TIn>, castF: (t: TIn) => TOut) => Record<string, TOut>;
50
50
  /** remove key values from an object where the value is null or undefined or other specific passed in values */
51
- export declare const removeUndefValuesFromObject: <T>(orig: Record<string, T>, ...additionalRemoves: T[]) => Record<string, T>;
51
+ export declare const removeUndefValuesFromObject: <TA>(orig: Record<string, TA>) => Record<string, TA extends null | undefined ? never : TA>;
52
+ /** remove key values from an object where the value is null or undefined or other specific passed in values */
53
+ export declare const removeUndefValuesFromObjectAdditional: <T>(orig: Record<string, T>, ...additionalRemoves: T[]) => Record<string, T>;
52
54
  /**
53
55
  * cast Record<string,string[]|string> to Record<string,string>. can be used for querystring params
54
56
  * @param orig
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isObject = exports.castStringlyObject = exports.removeUndefValuesFromObject = exports.castObject = exports.objectToString = exports.paramsToObject = exports.objectAlphaSort = exports.objectToArray = exports.getObjectKeysAsNumber = exports.objectKeysToLowerCase = exports.isJson = exports.tryJsonParse = void 0;
3
+ exports.isObject = exports.castStringlyObject = exports.removeUndefValuesFromObjectAdditional = exports.removeUndefValuesFromObject = exports.castObject = exports.objectToString = exports.paramsToObject = exports.objectAlphaSort = exports.objectToArray = exports.getObjectKeysAsNumber = exports.objectKeysToLowerCase = exports.isJson = exports.tryJsonParse = void 0;
4
4
  const tryJsonParse = (str, defaultValue) => {
5
5
  if (!str) {
6
6
  return null;
@@ -131,7 +131,19 @@ const castObject = (orig, castF) => {
131
131
  };
132
132
  exports.castObject = castObject;
133
133
  /** remove key values from an object where the value is null or undefined or other specific passed in values */
134
- const removeUndefValuesFromObject = (orig,
134
+ const removeUndefValuesFromObject = (orig) => {
135
+ const ret = {};
136
+ Object.entries(orig).forEach(([k, v]) => {
137
+ if (v !== null && v !== undefined) {
138
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
139
+ ret[k] = v;
140
+ }
141
+ });
142
+ return ret;
143
+ };
144
+ exports.removeUndefValuesFromObject = removeUndefValuesFromObject;
145
+ /** remove key values from an object where the value is null or undefined or other specific passed in values */
146
+ const removeUndefValuesFromObjectAdditional = (orig,
135
147
  /** other than null or undefined */
136
148
  ...additionalRemoves) => {
137
149
  const ret = {};
@@ -142,7 +154,7 @@ const removeUndefValuesFromObject = (orig,
142
154
  });
143
155
  return ret;
144
156
  };
145
- exports.removeUndefValuesFromObject = removeUndefValuesFromObject;
157
+ exports.removeUndefValuesFromObjectAdditional = removeUndefValuesFromObjectAdditional;
146
158
  /**
147
159
  * cast Record<string,string[]|string> to Record<string,string>. can be used for querystring params
148
160
  * @param orig
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.662",
2
+ "version": "0.0.663",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",