@mdf.js/utils
Version:
MMS - API Core - Common utils tools
25 lines • 804 B
JavaScript
;
/**
* Copyright 2024 Mytra Control S.L. All rights reserved.
*
* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
* or at https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.filterUnprefixed = filterUnprefixed;
const lodash_1 = require("lodash");
/**
* Return the an object with the keys that are prefixed with the given prefix
* @param object - object to be filtered
* @param prefix - prefix to be filtered
* @returns
*/
function filterUnprefixed(object, prefix) {
if (typeof prefix === 'string') {
return (0, lodash_1.pickBy)(object, (value, key) => key.startsWith(prefix));
}
else {
return object;
}
}
//# sourceMappingURL=filters.js.map