@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
20 lines • 984 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeWithMergingArrays = exports.ensureArray = exports.ensureArrayOrNull = exports.notNil = void 0;
const lodash_1 = require("lodash");
function notNil(value) {
return value !== null && value !== undefined;
}
exports.notNil = notNil;
const ensureArrayOrNull = (s) => (0, lodash_1.isNil)(s) ? null : Array.isArray(s) ? s : [s];
exports.ensureArrayOrNull = ensureArrayOrNull;
const ensureArray = (s) => { var _a; return (_a = (0, exports.ensureArrayOrNull)(s)) !== null && _a !== void 0 ? _a : []; };
exports.ensureArray = ensureArray;
// see https://github.com/lodash/lodash/issues/5384
const mergeWithMergingArrays = (obj1, obj2) => {
return (0, lodash_1.mergeWith)({}, obj1, obj2, (prop1, prop2) => Array.isArray(prop1) && Array.isArray(prop2)
? [...prop1, ...prop2]
: undefined);
};
exports.mergeWithMergingArrays = mergeWithMergingArrays;
//# sourceMappingURL=index.js.map