chitu (Chuck Her In The Ute)
youtube.com/watch?v=9i2eZaJsC7g
JavaScript Utilities
Installation
via npm
> npm install chitu --save
via yarn
> yarn add chitu
Modules available
Chitu exports 3 module types:
- ES Module (
dist/chitu.es.js
) https://unpkg.com/chitu@latest/dist/chitu.es.js
- Common JS (
dist/chitu.js
) https://unpkg.com/chitu@latest/dist/chitu.js
const chitu =
- UMD (
dist/chitu.umd.js
) https://unpkg.com/chitu@latest/dist/chitu.umd.js
// Available onwindowchitu
Usage
type
A module to check the type of a given value.
type // = truetype // = truetype // = truetype // = truetype // = truetype // = truetype // = truetype // = truetype // = truetype // = truetype // = true // or for anything elsetype // = truetype // = truetype // = true// etc
value
Check if the value is a function and execute it (with provided parameters) or simply return the value.
const foo = a * b * cconst bar = 'baz' const fooVal = // = 8const barVal = // = ['baz']
round
Round a number to a given number of decimal places.
// = 123.46 // = 1.00 // = 1.94// etc
ordinal
Return the ordinal value for a given number.
// = '1st' // = '2nd' // = '3rd' // = '4th' // = '12th' // = '101st'// etc
time
Return the human readable time string for a given number of seconds.
// = '00:25' // = '01:40' // = '01:23:20'// etc
dot
Get an item from a given object using string dot notation.
const obj = foo: bar: 'lorem' baz: bob: true qux: null // = 'lorem' // = true // = true // = 'someDefault' // = undefined// etc
random
Generate a "random" alpha-numeric string.
// = 'Ky6zJuGnGyrnvw1y' // = 'nKusDo5JIFrI1tJswwzpEyGLpvML1Mxp'// etc