import * as pluralize from 'pluralize' ; import camelcase from 'camelcase' ; import * as changeCase from 'change-case' ; import { titleCase as _titleCase } from 'title-case' ; import { paramCase as _paramCase } from 'param-case' ; param word export function isPlural ( word ) { return pluralize . isPlural ( word ) ; } param word export function isSingular ( word ) { return pluralize . isSingular ( word ) ; } export function camelCase ( input ) { return camelcase ( input ) ; } export function pascalCase ( input ) { return camelcase ( input , { pascalCase : true } ) ; } export function titleCase ( input ) { return _titleCase ( input ) ; } export function headerCase ( input , options ? ) { return changeCase . headerCase ( input , options ) ; } export function snakeCase ( input , options ? ) { return changeCase . snakeCase ( input , options ) ; } export function paramCase ( input , options ? ) { return _paramCase ( input , options ) ; } export function isString ( value ) { return typeof value === 'string' ; } export function generateRandomId ( length = 32 ) { let result = '' ; const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ; const charactersLength = characters . length ; for ( let i = 0 ; i < length ; i ++ ) { result += characters . charAt ( Math . floor ( Math . random ( ) * charactersLength ) ) ; } return result ; }