1 Star 0 Fork 1

matrixgo2023 / util

forked from theajack / util 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

tc-util

stars forks version downloads jsdelivr

author license Size TopLang issue Dependent

一些常用的工具方法

English | Update Log | Feedback bug | Gitee


0. 模块

  1. byte
  2. constant
  3. cookie
  4. datetime
  5. dom
  6. extend
  7. gbk
  8. is
  9. lib
  10. math
  11. polyfill
  12. storage
  13. tool
  14. event

1. 安装使用

1.1 npm

npm i tc-util

完整引用

import tcUtil from 'tc-util'; 

按需引入

import tcMath from 'tc-util/math'; 
import {formatDate} from 'tc-util/datetime';

1.2 cdn 引入

完整引用

<script src="https://cdn.jsdelivr.net/npm/tc-util/tc-util.min.js"></script>
<script>
    console.log(tcUtil);
</script>

按需引入

<script src="https://cdn.jsdelivr.net/npm/tc-util/math.js"></script>
<script>
    console.log(tcMath);
</script>

2. api

2.1. byte

  1. stringToBytes
  2. stringToGbkBytes
  3. bytesToString
  4. bytesToNumber

2.2. constant

  1. TYPE
  2. UINT_TYPE
  3. VERSION
  4. COMPARE_RESULT

2.3. cookie

  1. getCookie
  2. setCookie
  3. removeCookie

2.4. datetime

  1. getDaysInMonth
  2. getFirstDayWeekInMonth
  3. formatTime
  4. formatDate
  5. timeToJson
  6. dateToJson
  7. timeToDate
  8. dateToTime
  9. nowTime
  10. nowDate
  11. msToSecond
  12. secondToMs
  13. minuteToMs
  14. hourToMs

2.5. dom

  1. $: 请参考 easy-dom-util
  2. registDisableContextMenu
  3. disableDefaultEvent
  4. onPageShowHide

2.6. extend

  1. String
  2. Array
  3. Number
  4. Function
  5. Object
  6. Json

2.7. gbk

  1. encodeGBK
  2. decodeGBK

2.8. is

  1. isUndf
  2. isFunc
  3. isObject
  4. isJson
  5. isJsonOrArray
  6. isNumber
  7. isNull
  8. isBool
  9. isString
  10. isType
  11. isArray
  12. isPC
  13. isMobile
  14. isIOS
  15. isAndroid
  16. isWX
  17. isQQ
  18. isTenVideo
  19. isWxMiniProgram
  20. isIOSWx
  21. isIPAddress
  22. isInited

2.9. lib

  1. creatEventReady
  2. createDotAnimation
  3. createState
  4. createStatus

2.10. math

  1. countDistance
  2. countDistanceByDiff
  3. countSumOfSquare
  4. countValueByRateAndRange
  5. circleToRect
  6. isPointInRect
  7. isPointInCircle
  8. countPosDiffByStep

2.11. polyfill

  1. keys
  2. values
  3. assign

2.12. storage

  1. getStorage
  2. setStorage
  3. removeStorage

2.13. tool

tcUtil._

  1. getUrlParam
  2. parseUrlParam
  3. copy
  4. type
  5. random
  6. download
  7. execute
  8. importScript
  9. readFile
  10. mapArray
  11. mapJson
  12. parseJSON
  13. pick
  14. pickAttr
  15. pickTo
  16. removeRedundantAttrInObject
  17. getUUID
  18. boolPipe
  19. throttle
  20. countImgSize
  21. compareVersion
  22. versionToArray

2.14. event

请参考 tc-util

The MIT License (MIT) Copyright (c) 2019 - present Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

常用的工具方法 展开 收起
TypeScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
TypeScript
1
https://gitee.com/matrixgo2023/util.git
git@gitee.com:matrixgo2023/util.git
matrixgo2023
util
util
master

搜索帮助