@highlight-ui/utils-commons
Advanced tools
Comparing version 1.1.2 to 1.2.0
export * from './src/globalConstants'; | ||
export * from './src/types'; | ||
export { default as forkHandlers } from './src/forkHandlers'; | ||
export { default as parseMetadata } from './src/parseMetadata'; | ||
export { parseMetadata, suffixMetadata } from './src/parseMetadata'; |
@@ -6,2 +6,4 @@ 'use strict'; | ||
var kebabCase = require('lodash/fp/kebabCase'); | ||
var mapValues = require('lodash/fp/mapValues'); | ||
var curry = require('lodash/fp/curry'); | ||
@@ -11,2 +13,4 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var kebabCase__default = /*#__PURE__*/_interopDefaultLegacy(kebabCase); | ||
var mapValues__default = /*#__PURE__*/_interopDefaultLegacy(mapValues); | ||
var curry__default = /*#__PURE__*/_interopDefaultLegacy(curry); | ||
@@ -54,2 +58,28 @@ var ICON_MAP = { | ||
} | ||
/** | ||
* 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__default['default'](function (metadata, suffix) { return mapValues__default['default'](function (val) { return val + "-" + suffix; }, metadata); }); | ||
@@ -60,2 +90,3 @@ exports.ICON_MAP = ICON_MAP; | ||
exports.parseMetadata = parseMetadata; | ||
exports.suffixMetadata = suffixMetadata; | ||
//# sourceMappingURL=index.js.map |
@@ -0,3 +1,29 @@ | ||
/// <reference types="lodash" /> | ||
import { ComponentMetadata, ParsedMetadata } from './types'; | ||
declare function parseMetadata(metadata: ComponentMetadata | null | undefined): ParsedMetadata; | ||
export default parseMetadata; | ||
export declare function parseMetadata(metadata: ComponentMetadata | null | undefined): ParsedMetadata; | ||
/** | ||
* 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 | ||
*/ | ||
export declare const suffixMetadata: import("lodash").CurriedFunction2<ComponentMetadata | null | undefined, string, ComponentMetadata>; |
export * from './src/globalConstants'; | ||
export * from './src/types'; | ||
export { default as forkHandlers } from './src/forkHandlers'; | ||
export { default as parseMetadata } from './src/parseMetadata'; | ||
export { parseMetadata, suffixMetadata } from './src/parseMetadata'; |
import kebabCase from 'lodash/fp/kebabCase'; | ||
import mapValues from 'lodash/fp/mapValues'; | ||
import curry from 'lodash/fp/curry'; | ||
@@ -44,4 +46,30 @@ var ICON_MAP = { | ||
} | ||
/** | ||
* 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 { ICON_MAP, THEME_COLOR_TOKEN_MAP, forkHandlers, parseMetadata }; | ||
export { ICON_MAP, THEME_COLOR_TOKEN_MAP, forkHandlers, parseMetadata, suffixMetadata }; | ||
//# sourceMappingURL=index.js.map |
@@ -0,3 +1,29 @@ | ||
/// <reference types="lodash" /> | ||
import { ComponentMetadata, ParsedMetadata } from './types'; | ||
declare function parseMetadata(metadata: ComponentMetadata | null | undefined): ParsedMetadata; | ||
export default parseMetadata; | ||
export declare function parseMetadata(metadata: ComponentMetadata | null | undefined): ParsedMetadata; | ||
/** | ||
* 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 | ||
*/ | ||
export declare const suffixMetadata: import("lodash").CurriedFunction2<ComponentMetadata | null | undefined, string, ComponentMetadata>; |
{ | ||
"name": "@highlight-ui/utils-commons", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"author": "PPU", | ||
@@ -40,3 +40,3 @@ "main": "dist/cjs/index.js", | ||
}, | ||
"gitHead": "5168442d1a617119f95b721e6580aa57897bb4f7" | ||
"gitHead": "dbb9622f81d2ab986a66c1e7293863da40fb8e62" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26931
296