Socket
Socket
Sign inDemoInstall

@highlight-ui/utils-commons

Package Overview
Dependencies
Maintainers
4
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@highlight-ui/utils-commons - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

53

dist/esm/index.js

@@ -1,3 +0,52 @@

export { default as forkHandlers } from './src/forkHandlers.js';
export { parseMetadata, suffixMetadata } from './src/parseMetadata.js';
import kebabCase from 'lodash/fp/kebabCase';
import mapValues from 'lodash/fp/mapValues';
import curry from 'lodash/fp/curry';
var forkHandlers = function (handlers) {
return function (e) {
handlers.forEach(function (handler) {
if (handler) handler(e);
});
};
};
function parseMetadata(metadata) {
return metadata ? Object.keys(metadata).reduce(function (acc, key) {
acc["data-" + kebabCase(key)] = metadata[key] || '';
return acc;
}, {}) : {};
}
/**
* This function allows to generate a new object that
* contains metadata with values suffixed with provided suffix
*
* @example
* ```ts
* suffixMetadata(metadata, 'inner')
* ```
*
* This function is curried:
*
* @example
* ```ts
* const { metadata } = props;
* const suffixedMeta = suffixMetadata(metadata);
* ...
* <div {...parseMetadata(suffixedMeta('innerPart1'))}>
* <div {...parseMetadata(suffixedMeta('innerPart2'))} />
* </div>
* ```
*
* @param {ComponentMetadata} metadata The original metadata object
* @param {string} suffix A string to be added to the values of the original metadata object
* @returns {ComponentMetadata} The metadata object with values containing suffixes
*/
var suffixMetadata = curry(function (metadata, suffix) {
return mapValues(function (val) {
return val + "-" + suffix;
}, metadata);
});
export { forkHandlers, parseMetadata, suffixMetadata };
//# sourceMappingURL=index.js.map

6

package.json
{
"name": "@highlight-ui/utils-commons",
"version": "2.0.2",
"version": "2.0.3",
"author": "PPU",

@@ -26,3 +26,3 @@ "main": "dist/cjs/index.js",

"@highlight-ui/configs-base-tsconfig": "^3.0.0",
"@highlight-ui/configs-scripts": "^3.0.1",
"@highlight-ui/configs-scripts": "^3.0.2",
"jest": "^27.2.3",

@@ -40,3 +40,3 @@ "lodash": "^4.17.21",

},
"gitHead": "74898119989d62b9808c3aa67448f8ec487c6d25"
"gitHead": "06cfa844ed2c2451503171e1117652cec7fc243a"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc