@cumulus/common 18.0.0 → 18.1.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/package.json +5 -5
- package/util.d.ts +28 -1
- package/util.js +20 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/common",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.1.0",
|
|
4
4
|
"description": "Common utilities used across tasks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"GIBS",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@aws-sdk/client-s3": "^3.58.0",
|
|
46
46
|
"@aws-sdk/signature-v4-crt": "^3.58.0",
|
|
47
|
-
"@cumulus/aws-client": "18.
|
|
48
|
-
"@cumulus/errors": "18.
|
|
49
|
-
"@cumulus/logger": "18.
|
|
47
|
+
"@cumulus/aws-client": "18.1.0",
|
|
48
|
+
"@cumulus/errors": "18.1.0",
|
|
49
|
+
"@cumulus/logger": "18.1.0",
|
|
50
50
|
"ajv": "^6.12.3",
|
|
51
51
|
"aws-sdk": "^2.585.0",
|
|
52
52
|
"follow-redirects": "^1.2.4",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"@types/node-forge": "^0.9.5",
|
|
69
69
|
"@types/url-join": "^4.0.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "8428a02e0903d8d303c7dd36215aa6a24906e07b"
|
|
72
72
|
}
|
package/util.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Simple utility functions
|
|
3
|
+
*
|
|
3
4
|
* @module util
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
import type { PartialObject, ValueKeyIteratee, NumericDictionary, Dictionary } from 'lodash';
|
|
6
7
|
/**
|
|
7
8
|
* Mark a piece of code as deprecated.
|
|
8
9
|
*
|
|
@@ -42,4 +43,30 @@ export declare const removeNilProperties: <T extends object>(obj: T) => { [P in
|
|
|
42
43
|
*/
|
|
43
44
|
export declare const isOneOf: import("lodash").CurriedFunction2<unknown[], unknown, boolean>;
|
|
44
45
|
export declare const returnNullOrUndefinedOrDate: (dateVal: string | number | null | undefined) => Date | null | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* This is from https://github.com/siberiacancode/lodash-omitdeep/blob/main/src/omitDeepBy/omitDeepBy.ts
|
|
48
|
+
* That repo uses outdated lodash packages.
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* The opposite of `_.pickBy`; this method creates an object composed of the
|
|
52
|
+
* own and inherited enumerable properties of `object` that `predicate`
|
|
53
|
+
* doesn't return truthy for.
|
|
54
|
+
*
|
|
55
|
+
* @param {object} object - The source object.
|
|
56
|
+
* @param [predicate=_.identity] - The function invoked per property.
|
|
57
|
+
* @returns Returns the new object.
|
|
58
|
+
* @example
|
|
59
|
+
*
|
|
60
|
+
* const object = { 'a': 1, 'b': null, 'c': { 'a': 1, 'b': null } };
|
|
61
|
+
*
|
|
62
|
+
* omitByDeep(object, _.isNil);
|
|
63
|
+
* // => { 'a': 1, 'c': { 'a': 1 } }
|
|
64
|
+
*/
|
|
65
|
+
interface OmitDeepBy {
|
|
66
|
+
<T>(object: Dictionary<T> | null | undefined, predicate?: ValueKeyIteratee<T>): Dictionary<T>;
|
|
67
|
+
<T>(object: NumericDictionary<T> | null | undefined, predicate?: ValueKeyIteratee<T>): NumericDictionary<T>;
|
|
68
|
+
<T extends object>(object: T | null | undefined, predicate: ValueKeyIteratee<T[keyof T]>): PartialObject<T>;
|
|
69
|
+
}
|
|
70
|
+
export declare const omitDeepBy: OmitDeepBy;
|
|
71
|
+
export {};
|
|
45
72
|
//# sourceMappingURL=util.d.ts.map
|
package/util.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Simple utility functions
|
|
4
|
+
*
|
|
4
5
|
* @module util
|
|
5
6
|
*/
|
|
6
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -30,7 +31,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
30
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
32
|
};
|
|
32
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.returnNullOrUndefinedOrDate = exports.isOneOf = exports.removeNilProperties = exports.deprecate = void 0;
|
|
34
|
+
exports.omitDeepBy = exports.returnNullOrUndefinedOrDate = exports.isOneOf = exports.removeNilProperties = exports.deprecate = void 0;
|
|
35
|
+
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
|
|
34
36
|
const curry_1 = __importDefault(require("lodash/curry"));
|
|
35
37
|
const isNil_1 = __importDefault(require("lodash/isNil"));
|
|
36
38
|
const omitBy_1 = __importDefault(require("lodash/omitBy"));
|
|
@@ -88,4 +90,21 @@ exports.removeNilProperties = removeNilProperties;
|
|
|
88
90
|
exports.isOneOf = (0, curry_1.default)((collection, val) => collection.includes(val), 2);
|
|
89
91
|
const returnNullOrUndefinedOrDate = (dateVal) => ((0, isNil_1.default)(dateVal) ? dateVal : new Date(dateVal));
|
|
90
92
|
exports.returnNullOrUndefinedOrDate = returnNullOrUndefinedOrDate;
|
|
93
|
+
const omitDeepBy = (object, cb) => {
|
|
94
|
+
function omitByDeepByOnOwnProps(obj) {
|
|
95
|
+
if (!Array.isArray(obj) && !(0, isPlainObject_1.default)(obj)) {
|
|
96
|
+
return obj;
|
|
97
|
+
}
|
|
98
|
+
if (Array.isArray(obj)) {
|
|
99
|
+
return obj.map((element) => (0, exports.omitDeepBy)(element, cb));
|
|
100
|
+
}
|
|
101
|
+
const temp = {};
|
|
102
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
103
|
+
temp[key] = (0, exports.omitDeepBy)(value, cb);
|
|
104
|
+
}
|
|
105
|
+
return (0, omitBy_1.default)(temp, cb);
|
|
106
|
+
}
|
|
107
|
+
return omitByDeepByOnOwnProps(object);
|
|
108
|
+
};
|
|
109
|
+
exports.omitDeepBy = omitDeepBy;
|
|
91
110
|
//# sourceMappingURL=util.js.map
|