UNPKG

@sap/xssec

Version:

XS Advanced Container Security API for node.js

16 lines (15 loc) 631 B
/** * Creates a cache key string from the given object by concatenating its key-value pairs. * Each pair is formatted as "key=value" and pairs are joined by a pipe ("|"). * Keys with null or undefined values are omitted from the resulting string. * * @param {Object} [parts={}] - The object containing key-value pairs to include in the cache key. * @returns {string} The generated cache key string. */ function createCacheKey(parts = {}) { return Object.entries(parts) .filter(([, value]) => value != null) .map(([key, value]) => `${key}=${value}`) .join("|"); } module.exports = createCacheKey;