@capillarytech/cap-ui-utils 1.3.7 → 1.3.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capillarytech/cap-ui-utils",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "Utility functions shared accross all the modules",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,5 +1,7 @@
1
1
  import { isEmpty } from "lodash";
2
- import { isNegativeNumber } from "./validationHelper";
2
+ import validationHelper from "./validationHelper";
3
+
4
+ const { isNegativeNumber } = validationHelper;
3
5
 
4
6
  const snakeCaseToCamelCase = (string) => {
5
7
  const regex = /(\_\w)/g; //eslint-disable-line
@@ -1,6 +1,6 @@
1
1
  import { isEmpty, isEqual, isString } from "lodash";
2
2
 
3
- const reduceValidators = ({ value, validatorFuncs, errorsMsgs }) => {
3
+ const reduceValidators = ({ value, validatorFuncs, errorsMsgs }) => {
4
4
  const validate = validatorFuncs.reduce(
5
5
  (acc, func, index) => {
6
6
  if (acc.isValid) {
@@ -23,23 +23,24 @@ const reduceValidators = ({ value, validatorFuncs, errorsMsgs }) => {
23
23
  );
24
24
  return validate;
25
25
  };
26
- const isFieldNotEmpty = (value) =>
26
+ const isFieldNotEmpty = (value) =>
27
27
  typeof value === "number" ? value : !isEmpty(value);
28
28
 
29
- const areValuesNotEqual = (value1, value2) => !isEqual(value1, value2);
29
+ const areValuesNotEqual = (value1, value2) => !isEqual(value1, value2);
30
30
 
31
- const isPhoneNumber = (value) => {
31
+ const isPhoneNumber = (value) => {
32
32
  const digitsRegex = new RegExp(/^\d+$/gi); //eslint-disable-line
33
33
  return digitsRegex.test(value);
34
34
  };
35
- const isEmail = (value) => {
35
+ const isEmail = (value) => {
36
36
  const emailRegex = new RegExp(
37
37
  /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/ //eslint-disable-line
38
38
  );
39
39
  return emailRegex.test(value);
40
40
  };
41
- const isNegativeNumber = (value) => value < 0;
42
- const getBoolean = (value) => (isString(value) ? value === "true" : value);
41
+ const isNegativeNumber = (value) => value < 0;
42
+ const getBoolean = (value) =>
43
+ isString(value) ? value === "true" : value;
43
44
 
44
45
  export default {
45
46
  reduceValidators,