Sha256: e478ebf07cb020c4350033fa5b725d417716b1868a4ed2b65e6d5458c2363ecf

Contents?: true

Size: 650 Bytes

Versions: 16

Compression:

Stored size: 650 Bytes

Contents

import { snakeCase, camelCase } from 'lodash';

export const stringIsPositiveNumber = (value) => {
  const reg = new RegExp('^[0-9]+$');
  return reg.test(value);
};
const propsToCase = (casingFn, errorMsg, ob) => {
  if (typeof ob !== 'object') throw Error(errorMsg);

  return Object.keys(ob).reduce((memo, key) => {
    // eslint-disable-next-line no-param-reassign
    memo[casingFn(key)] = ob[key];
    return memo;
  }, {});
};

export const propsToSnakeCase = ob =>
  propsToCase(snakeCase, 'propsToSnakeCase only takes objects', ob);

export const propsToCamelCase = ob =>
  propsToCase(camelCase, 'propsToCamelCase only takes objects', ob);

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
katello-3.15.3.1 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.3 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.2 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.1.1 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.1 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.0.1 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.0 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.0.rc2 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.0.rc1.3 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.0.rc1.2 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.0.rc1.1 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.15.0.rc1 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.14.1 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.14.0 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.14.0.rc2 webpack/__mocks__/foremanReact/common/helpers.js
katello-3.14.0.rc1 webpack/__mocks__/foremanReact/common/helpers.js