zinutils v0.0.41
zinUtils
Quickstart
Installation
npm install zinutils
import { [MODUELs] } from "zinutils"
[MODUELs].Function()
Initial configuration
(Optional, but not entirely optional, still initialized XD)
// main.js
// For vite
import "zinutils/init/vite";
// For vue/cli
import "zinutils/init/webpack";
// Other (or not import, window.znConf.isDevelopment will default to true)
import "zinutils/init";
window.znConf | Variable name | Description | type | Default | | ------------- | ------------------ | :-----: | :-------: | | isDevelopment | Lazy to explain :D | Boolean | true | | isIOS | Lazy to explain :D | Boolean | undefined | | isIPad | Lazy to explain :D | Boolean | undefined | | isAndroid | Lazy to explain :D | Boolean | undefined | | isPC | Lazy to explain :D | Boolean | undefined |
Global binding for vue
// main.js
// Vue 3
import { vue3 as zinUtils } from "zinutils/init";
// Vue 2
import { vue3 as zinUtils } from "zinutils/init";
App.use(zinUtils);
Usage
this.$dev.log("Good day");
Module
Contents
common
import { common } from "zinutils";
Function
Function name | Description | Parameter | Description | type | return |
---|---|---|---|---|---|
debounce | see here | func, delay | Lazy to explain :D | - | Guess |
getParam | Get a url parameter | paramName | Lazy to explain :D | String | String/null |
check
import { check } from "zinutils";
Function
Function name | Description | Parameter | Description | type | return |
---|---|---|---|---|---|
isNull | Is null | content | - | Array/Object/String | Boolean |
hasNull | Obj/arr's sub item has null | testBuffer, useGenerator = false | Look source code | Array/Object | Boolean |
isObject | isObject | checkBuffer, includeArray = false | - | Any | Boolean |
isPhone | Is phone number | phone | - | - | Boolean |
time
import { time } from "zinutils";
Function
Function name | Description | Parameter | Description | type | return |
---|---|---|---|---|---|
sleep | Like python's time.sleep, need to use await | ms | - | - | Void |
filter
import { filter } from "zinutils";
Function
Function name | Description | Parameter | Description | type | return |
---|---|---|---|---|---|
limitLen | Length limit | content, length | Content and target length | String | String |
parseNum | Remove other characters except numbers in the string | content | - | String | String |
encrypt
import { encrypt } from "zinutils";
encrypt.md5 (See md5.js for more info.)
Function
Function name | Description | Parameter | Description | type | return |
---|---|---|---|---|---|
hex | hex_md5 | s | Lazy to explain :D | - | String |
base64 | b64_md5 | s | Lazy to explain :D | - | String |
any | any_md5 | s,e | Lazy to explain :D | - | String |
encrypt.hmacmd5 (See md5.js for more info.)
Function
Function name | Description | Parameter | Description | type | return |
---|---|---|---|---|---|
hex | hex_hmac_md5 | k,d | Lazy to explain :D | - | String |
base64 | b64_hmac_md5 | k,d | Lazy to explain :D | - | String |
any | any_hmac_md5 | k,d,e | Lazy to explain :D | - | String |
auth
import { auth } from "zinutils";
Function
Function name | Description | Parameter | Description | type | return |
---|---|---|---|---|---|
getFingerPrint | Get browser fingerprint (not unique) | - | - | - | String |
mobile
import { mobile } from "zinutils";
// You can also import it directly into main.js, It will automatically execute some functions (Now only disableZoom)
import "zinutils/mobile";
Function
Function name | Description | Parameter | Description | type | return |
---|---|---|---|---|---|
disableZoom | Disable mobile zooming via meta tag | - | - | - | Void |
disableElasticScrolling | Disable IOS elastic scrolling | - | - | - | Void |
enableElasticScrolling | enable IOS elastic scrolling | - | - | - | Void |
inputRec | Fix the rebound error of input box under IOS | inputEl | input element | String | Void |
inputsRec | Fix the rebound error of input box under IOS | wrapEl | Parent element of multiple inputs | String | Void |
dev
Need to initialize configuration
import { dev } from "zinutils";
Function
Function name | Description | Parameter | Description | type | return |
---|---|---|---|---|---|
log | Output log in development environment | - | - | - | - |
logError | Output error in development environment | - | - | - | - |
logWarn | Output warn in development environment | - | - | - | - |
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago