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