@zohodesk/utils 1.0.2-alpha.6 → 1.0.3-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,5 @@
1
+ import "core-js/modules/es.array.includes";
2
+
1
3
  /**
2
4
  * Opening the customization, need to addd for behaviour changes. also add only enabled.
3
5
  * @param {*} style
package/es/mergeStyle.js CHANGED
@@ -1,28 +1,31 @@
1
+ import "core-js/modules/es.array.includes";
2
+
1
3
  /**
2
- * REPLACER_SYMBOL used to indentify
4
+ * REPLACER_SYMBOL used to indentify
3
5
  */
4
- const REPLACER_SYMBOL = "$";
6
+ const REPLACER_SYMBOL = '$';
5
7
  /**
6
8
  * $ startWith is used for replace the existing style.
7
9
  * all other will be append
8
- * @param {*} defaultStyle
10
+ * @param {*} defaultStyle
9
11
  * @param {*} customStyle
10
12
  * @returns
11
13
  */
12
14
 
13
15
  export default function mergeStyle(defaultStyle, customStyle) {
16
+ let additionalStyle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
14
17
  return Object.keys(customStyle).reduce((res, next) => {
15
18
  if (next.startsWith(REPLACER_SYMBOL)) {
16
19
  let styleValue = customStyle[next];
17
- let styleName = next.replace(REPLACER_SYMBOL, "");
20
+ let styleName = next.replace(REPLACER_SYMBOL, '');
18
21
 
19
- if (!defaultStyle[styleName]) {
22
+ if (!defaultStyle[styleName] && !additionalStyle.includes(styleName)) {
20
23
  return res;
21
24
  }
22
25
 
23
26
  res[styleName] = styleValue;
24
- } else if (defaultStyle[next]) {
25
- res[next] = defaultStyle[next] + " " + customStyle[next];
27
+ } else if (defaultStyle[next] || additionalStyle.includes(next)) {
28
+ res[next] = (defaultStyle[next] || '') + ' ' + customStyle[next];
26
29
  }
27
30
 
28
31
  return res;
package/es/omit.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "core-js/modules/es.array.includes";
1
2
  export default (keys => {
2
3
  return function omit(obj) {
3
4
  return Object.keys(obj).reduce((res, next) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/utils",
3
- "version": "1.0.2-alpha.6",
3
+ "version": "1.0.3-alpha.0",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -22,5 +22,5 @@
22
22
  ],
23
23
  "author": "",
24
24
  "license": "ISC",
25
- "gitHead": "1e10e361945e34249b07af74c82dfc9c142a37cb"
25
+ "gitHead": "da782dc40951b76af85d2091c4c72dd2a6bf6969"
26
26
  }