@punks/backend-core 0.0.78 → 0.0.80
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/dist/cjs/index.js +19 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/utils/index.d.ts +2 -2
- package/dist/cjs/types/utils/objects/index.d.ts +2 -0
- package/dist/cjs/types/utils/objects/types.d.ts +3 -0
- package/dist/esm/index.js +19 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/utils/index.d.ts +2 -2
- package/dist/esm/types/utils/objects/index.d.ts +2 -0
- package/dist/esm/types/utils/objects/types.d.ts +3 -0
- package/dist/index.d.ts +6 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ export { CsvColumnDefinition, CsvBuildOptions, csvBuild, csvParse } from "./csv"
|
|
|
5
5
|
export { getDirectoryFilePaths } from "./files";
|
|
6
6
|
export { joinPath, splitPath, ensureDirectory, getDirectoryPath, createDayPath, } from "./paths";
|
|
7
7
|
export * from "./strings";
|
|
8
|
-
export
|
|
8
|
+
export { buildObject, isNullOrUndefined, jsonSerialize, mergeDeep, removeUndefinedProps, replaceUndefinedWithNull, } from "./objects";
|
|
9
9
|
export * from "./encoding";
|
|
10
10
|
export { stripTags } from "./html";
|
|
11
11
|
export { maskVariable } from "./variables";
|
|
@@ -13,6 +13,6 @@ export * from "./text";
|
|
|
13
13
|
export * from "./threading";
|
|
14
14
|
export { buildTree, TreeNodeBuilder } from "./trees";
|
|
15
15
|
export * from "./mappings";
|
|
16
|
-
export
|
|
16
|
+
export { newUuid, generateHash } from "./uid";
|
|
17
17
|
export { serializeQueryString, buildUrl, deserializeQueryString, getQueryParameter, updateQueryParameters, joinUrl, } from "./urls";
|
|
18
18
|
export { ExcelSheetDefinition, ExcelKeyTransform, ExcelColumnDefinition, ExcelParseOptions, excelBuild, excelParse, } from "./xls";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReplaceUndefinedWithNull } from "./types";
|
|
1
2
|
export declare const removeUndefinedProps: <T extends Record<string, any>>(obj: T, options?: {
|
|
2
3
|
recursive?: boolean;
|
|
3
4
|
}) => T;
|
|
@@ -14,3 +15,4 @@ export declare const jsonSerialize: (obj: any, options?: {
|
|
|
14
15
|
maxStringsLength?: number;
|
|
15
16
|
prettify?: boolean;
|
|
16
17
|
}) => string;
|
|
18
|
+
export declare function replaceUndefinedWithNull<T>(obj: T): ReplaceUndefinedWithNull<T>;
|
package/dist/esm/index.js
CHANGED
|
@@ -411,6 +411,24 @@ const jsonSerialize = (obj, options) => {
|
|
|
411
411
|
const spaces = prettify ? 2 : undefined;
|
|
412
412
|
return JSON.stringify(obj, replacer, spaces);
|
|
413
413
|
};
|
|
414
|
+
function replaceUndefinedWithNull(obj) {
|
|
415
|
+
if (obj === undefined) {
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
if (typeof obj !== "object" || obj === null) {
|
|
419
|
+
return obj;
|
|
420
|
+
}
|
|
421
|
+
if (Array.isArray(obj)) {
|
|
422
|
+
return obj.map(replaceUndefinedWithNull);
|
|
423
|
+
}
|
|
424
|
+
const newObj = {};
|
|
425
|
+
for (const key in obj) {
|
|
426
|
+
if (obj.hasOwnProperty(key)) {
|
|
427
|
+
newObj[key] = replaceUndefinedWithNull(obj[key]);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return newObj;
|
|
431
|
+
}
|
|
414
432
|
|
|
415
433
|
const encodeUtf8 = (value) => Buffer.from(value).toString("utf-8");
|
|
416
434
|
const decodeUtf8 = (value) => Buffer.from(value, "utf-8");
|
|
@@ -31448,5 +31466,5 @@ const processArrayItemMove = (items, input) => {
|
|
|
31448
31466
|
}));
|
|
31449
31467
|
};
|
|
31450
31468
|
|
|
31451
|
-
export { ConsoleLogger, DatadogLogger, ExcelKeyTransform, FileLogger, Log, LogLevel, MetaSerializationType, addTime, buildObject, buildTree, buildUrl, byField, byFieldDesc, camelToKebabCase, camelToSnakeCase, createDayPath, csvBuild, csvParse, decodeBase64, decodeUtf8, deserializeQueryString, distinct, distinctElements, encodeBase64, encodeUtf8, ensureDirectory, ensureStartSlash, ensureTailingSlash, excelBuild, excelParse, first, flatten, floorDateToSecond, generateHash, getDirectoryFilePaths, getDirectoryPath, getQueryParameter, groupBy, indexes, isNullOrUndefined, iterate, joinPath, joinUrl, jsonDistinct, jsonSerialize, last, logMemoryUsage, mapAsync, mapOrThrow, maskVariable, mergeDeep, multipleSplit, newUuid, notNull, notUndefined, pluralize, processArrayDifferences, processArrayItemMove, range, removeUndefinedProps, selectMany, serializeQueryString, sleep, sort, splitPath, stripTags, subArrays, subtractTime, testInternetConnection, toArrayDict, toCamelCase, toDict, toItemsDict, toItemsMap, toMap, toTitleCase, trim$1 as trim, trimEnd, trimStart, updateQueryParameters };
|
|
31469
|
+
export { ConsoleLogger, DatadogLogger, ExcelKeyTransform, FileLogger, Log, LogLevel, MetaSerializationType, addTime, buildObject, buildTree, buildUrl, byField, byFieldDesc, camelToKebabCase, camelToSnakeCase, createDayPath, csvBuild, csvParse, decodeBase64, decodeUtf8, deserializeQueryString, distinct, distinctElements, encodeBase64, encodeUtf8, ensureDirectory, ensureStartSlash, ensureTailingSlash, excelBuild, excelParse, first, flatten, floorDateToSecond, generateHash, getDirectoryFilePaths, getDirectoryPath, getQueryParameter, groupBy, indexes, isNullOrUndefined, iterate, joinPath, joinUrl, jsonDistinct, jsonSerialize, last, logMemoryUsage, mapAsync, mapOrThrow, maskVariable, mergeDeep, multipleSplit, newUuid, notNull, notUndefined, pluralize, processArrayDifferences, processArrayItemMove, range, removeUndefinedProps, replaceUndefinedWithNull, selectMany, serializeQueryString, sleep, sort, splitPath, stripTags, subArrays, subtractTime, testInternetConnection, toArrayDict, toCamelCase, toDict, toItemsDict, toItemsMap, toMap, toTitleCase, trim$1 as trim, trimEnd, trimStart, updateQueryParameters };
|
|
31452
31470
|
//# sourceMappingURL=index.js.map
|