A business-oriented JavaScript/TypeScript utility library

vtils

A business-oriented JavaScript/TypeScript utility library.

import { md5 } from 'vtils'

console.log(md5('龙'))
// => 682570a229cbd3d67e76ad99b3152060

characteristic

installation

## npm
above sea level and vtils

## yarn
yarn add vtils

## pnpm 
pnpm add vtils

If you are in China, it is recommended to install tbify and use Taobao mirror acceleration:

## npm
tnpm i vtils

## yarn
tyn add vtils

## pnpm tpm 
add vtils

use

Use in NodeJS

// master tool library 
Import  {  the wait ,  isNumber ,  EventBus ,  Base64Encode  }  from  'vtils'

Date Time tool magazine // 
Import  {  formatRelative ,  subDays ,  zhCN  }  from  'vtils / DATE'

// React 工具库
import { useClassName, useToggle, useScrollLoadMore } from 'vtils/react'

Verification tool magazine // 
Import  {  Yup  }  from  'vtils / Validator'

Type tool magazine // 
Import  {  OmitStrict ,  LiteralUnion ,  PartialDeep  }  from  'vtils / types'

Toolkit applet // 
Import  {  getTopBarInfo ,  navigatePageTo ,  redirectPageTo  }  from  'vtils / MP'

See the document for detailed usage: https://fjc0k.github.io/vtils/v3/ .

Used in Taro 3

In Taro 3 need to modify the configuration Webpack before use, in config/index.jsthe minisettings field:

mini: { 
  webpackChain ( config )  { 
    // This plugin will affect the performance of resolve.extensions, delete 
    config . resolve . plugins . delete ( 'MultiPlatformPlugin' ) 
    // support .taro.js suffix 
    config . resolve . extensions . prepend ( '.taro.js' ) 
  } , 
}

Then, you can use it happily:

// React tool magazine 
Import  {  useSearchParam  }  from  'vtils / REACT'

// Taro 3 tools Hyogo 
import  {  UseTopBarInfo  }  from  'Vtils / taro'

export  default  function  ( )  { 
  const  id  =  + useSearchParam ( 'id' ) !
  const  topBarInfo  =  useTopBarInfo , ( ), 
  // ... 
},

Use in Deno

Only basic tool library and type tool library are currently supported under Deno .

// master tool library 
Import  { 
  the wait , 
  isNumber , 
  EventBus , 
  Base64Encode , 
}  from  'https://cdn.skypack.dev/vtils@3.44.1'

Type tool magazine // 
Import  { 
  OmitStrict , 
  LiteralUnion , 
  PartialDeep , 
}  from  'https://cdn.skypack.dev/vtils@3.44.1/types'

Download Details:

Author: fjc0k

Demo: https://fjc0k.github.io/vtils/v3/

Source Code: https://github.com/fjc0k/vtils

#deno #nodejs #node #javascript

A business-oriented JavaScript/TypeScript utility library
2.45 GEEK