1.0.3 • Published 4 years ago
codeutil v1.0.3
CodeUtil
Module with some useful functions to help and simplify your code.
Functions
random(a) ⇒
Return a random array item.
Kind: global function
Returns: any
Param | Type | Description |
---|---|---|
a | Array | Array to get a random item |
Example
require('codeutil').Array.random(['abc', '123'])
random(max) ⇒ Number
Return a random number following the max number restriction
Kind: global function
Param | Type | Description |
---|---|---|
max | Number | max number |
Example
require('codeutil').Number.random()
random() ⇒ String
Will return a random string
Kind: global function
Example
require('codeutil').String.random()
toProperCase(str, start) ⇒ String
Modify the string to start with an upper case
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
str | String | string to get modified | |
start | Boolean | false | defines whether all words will start with a capital letter (false = no) |
Example
require('codeutil').String.toProperCase('hi abc no') // Hi abc no
require('codeutil').String.toProperCase('hi abc no', true) // Hi Abc No