@datacamp/waffles-utils
Advanced tools
Comparing version 3.1.1 to 3.2.0
@@ -6,2 +6,14 @@ # Change Log | ||
# [3.2.0](https://github.com/datacamp/design-system/compare/@datacamp/waffles-utils@3.1.1...@datacamp/waffles-utils@3.2.0) (2021-05-28) | ||
### Features | ||
* add hexToRgbaColor utility ([80b7065](https://github.com/datacamp/design-system/commit/80b7065)) | ||
* remove lodash from utils ([bb54e1d](https://github.com/datacamp/design-system/commit/bb54e1d)) | ||
## [3.1.1](https://github.com/datacamp/design-system/compare/@datacamp/waffles-utils@3.1.0...@datacamp/waffles-utils@3.1.1) (2021-03-04) | ||
@@ -8,0 +20,0 @@ |
@@ -1,2 +0,2 @@ | ||
import _mapKeys from "lodash/mapKeys"; | ||
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
@@ -7,7 +7,15 @@ /** | ||
var computeDataAttributes = function computeDataAttributes(dataAttributes) { | ||
return _mapKeys(dataAttributes, function (_, key) { | ||
return "data-".concat(key); | ||
}); | ||
if (!dataAttributes) { | ||
return {}; | ||
} | ||
return Object.fromEntries(Object.entries(dataAttributes).map(function (entry) { | ||
var _entry = _slicedToArray(entry, 2), | ||
key = _entry[0], | ||
value = _entry[1]; | ||
return ["data-".concat(key), value]; | ||
})); | ||
}; | ||
export default computeDataAttributes; |
export { default as computeDataAttributes } from './computeDataAttributes'; | ||
export { default as isChildType } from './isChildType'; | ||
export { default as ssrSafeNotFirstChildSelector } from './ssrSafeNotFirstChildSelector'; | ||
export { default as childrenOfType } from './childrenOfType'; | ||
export { default as childrenOfType } from './childrenOfType'; | ||
export { default as hexToRgbaColor } from './hexToRgbaColor'; |
@@ -10,3 +10,3 @@ "use strict"; | ||
var _mapKeys2 = _interopRequireDefault(require("lodash/mapKeys")); | ||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
@@ -17,5 +17,13 @@ /** | ||
var computeDataAttributes = function computeDataAttributes(dataAttributes) { | ||
return (0, _mapKeys2.default)(dataAttributes, function (_, key) { | ||
return "data-".concat(key); | ||
}); | ||
if (!dataAttributes) { | ||
return {}; | ||
} | ||
return Object.fromEntries(Object.entries(dataAttributes).map(function (entry) { | ||
var _entry = (0, _slicedToArray2.default)(entry, 2), | ||
key = _entry[0], | ||
value = _entry[1]; | ||
return ["data-".concat(key), value]; | ||
})); | ||
}; | ||
@@ -22,0 +30,0 @@ |
@@ -32,2 +32,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "hexToRgbaColor", { | ||
enumerable: true, | ||
get: function get() { | ||
return _hexToRgbaColor.default; | ||
} | ||
}); | ||
@@ -40,2 +46,4 @@ var _computeDataAttributes = _interopRequireDefault(require("./computeDataAttributes")); | ||
var _childrenOfType = _interopRequireDefault(require("./childrenOfType")); | ||
var _childrenOfType = _interopRequireDefault(require("./childrenOfType")); | ||
var _hexToRgbaColor = _interopRequireDefault(require("./hexToRgbaColor")); |
{ | ||
"name": "@datacamp/waffles-utils", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"description": "Various collection of utilities to be shared across waffles packages", | ||
@@ -35,3 +35,3 @@ "author": "Louis Bailey <louis@datacamp.com>", | ||
"@babel/core": "7.12.7", | ||
"@datacamp/waffles-babel-preset": "^3.0.3", | ||
"@datacamp/waffles-babel-preset": "^3.1.0", | ||
"@datacamp/waffles-tsconfig": "^2.0.0", | ||
@@ -46,3 +46,2 @@ "babel-jest": "26.6.3", | ||
"airbnb-prop-types": "^2.16.0", | ||
"lodash": "^4.17.20", | ||
"prop-types": "^15.7.2" | ||
@@ -53,3 +52,3 @@ }, | ||
}, | ||
"gitHead": "95e3b72f60b986d0bedd2736c56421a30e26770c" | ||
"gitHead": "8cdde08cc7299618ff402e6d80110836939780d3" | ||
} |
@@ -0,9 +1,8 @@ | ||
declare type DataAttributes = { | ||
[key: string]: string; | ||
}; | ||
/** | ||
* Prepends each key of an object with 'data-' | ||
*/ | ||
declare const computeDataAttributes: (dataAttributes?: { | ||
[key: string]: string; | ||
} | undefined) => { | ||
[key: string]: string; | ||
}; | ||
declare const computeDataAttributes: (dataAttributes?: DataAttributes | undefined) => DataAttributes; | ||
export default computeDataAttributes; |
@@ -5,1 +5,2 @@ export { default as computeDataAttributes } from './computeDataAttributes'; | ||
export { default as childrenOfType } from './childrenOfType'; | ||
export { default as hexToRgbaColor } from './hexToRgbaColor'; |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
25242
5
24
224
1
- Removedlodash@^4.17.20
- Removedlodash@4.17.21(transitive)