eigen-utils
Common util tool functions for frontend.
Installation
npm install eigen-utils --save
yarn add eigen-utils
Usage
import eigen from "eigen-utils"
eigen.md5("eigen")
eigen.isAlpha()
or
import { md5, isAlpha } from "eigen-utils"
md5("eigen")
isAlpha()
Tool functions
-
getAvatar()
get user avatar url (eigen use only) -
getCookie(name)
get cookie -
getRealname()
get current user realname (eigen use only) -
getUsername()
get current user username (eigen use only) -
isAlpha()
judge current env is alpha or production (same to isDevMode())(eigen use only) -
md5(str, bit)
md5 string -
hash(str)
hash a string to number -
uuid(len, radix)
generate uuid -
debounce(func, wait, immediate)
function debounce -
throttle(func, wait, options)
function throttle -
deepClone(object)
object deepclone -
type(variable)
judge variable type -
base64()
encode and deconde string -
isJSON(variable)
judge variable is JSON
Recommand Usage
import md5 from "eigen-utils/md5"
md5("eigen")