Sha256: 8977804876d5a71f84dd32965f3e858fb3153cffec8ba0e74736e788843f6941
Contents?: true
Size: 531 Bytes
Versions: 8
Compression:
Stored size: 531 Bytes
Contents
import { snakeCase } 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);
Version data entries
8 entries across 8 versions & 1 rubygems