utils-methods

前端开发中JS常用方法

Usage no npm install needed!

<script type="module">
  import utilsMethods from 'https://cdn.skypack.dev/utils-methods';
</script>

README

方法列表

  • 检测是否PC:isPC()
  • 检测是否苹果:isiOS()
  • 检测是否安卓:isAndroid()
  • 检测是否微信浏览器:isWeiXin()
  • 设置Cookie: setCookie(name,value,?day)
  • 读取Cookie: getCookie(name)
  • 删除Cookie: deleteCookie(name)
  • 修复URL歧义字符:fixedEncodeURI(string)
  • 大数相加:bigNumberAdd(string,string)
  • 富文本标签过滤: textFormat(string)
  • 日期格式化: dateFormat('yyyy-MM-dd hh:mm:ss',?Date)
  • 对象克隆:clone() 支持null undefined Date Array Object
  • 获取指定长度随机字符串:getKey(length)
  • 获取url参数:getQuery(url)

使用

  • npm install utils-methods
  • const utils = require('utils-methods')
  • console.log(utils)