scxutils

1.4.0 • Public • Published

scxutils


判断数据类型

import {judgeType} from 'scxutils'
judgeType('str')->string
judgeType({})->object
judgeType([])->array
judgeType(1)->number
judgeType(false)->boolean

接收字符串格式获取某参数

import {getAddressParam} from 'scxutils'
https://Desktop/demo/mzdfunctions/index.html?a=1&b=2 注意传参是单个的取值,不是url地址
getAddressParam('a')--->1
getAddressParam('b')--->2
-----------------

将url 问号后的参数转为对象格式

import {getUrlQuery} from 'scxutils'
注意传参是个字符串,可以取url地址(location.href)
let url = https://Desktop/demo/mzdfunctions/index.html?a=1&b=2
getUrlQuery(url)--->{a:1,b:2}
-----------------

深拷贝

import {deepClone} from 'scxutils'
用法 let obj = {name:1,address:{value:2}} let newObj = deepClone(c1); obj.address.value = 99; console.log(obj,newObj) ----------------- import {dataFormat} from 'scxutils'; //调用时间的格式化 const dt = new Date(); const newDt = dataFormat(dt);

Readme

Keywords

none

Package Sidebar

Install

npm i scxutils

Weekly Downloads

4

Version

1.4.0

License

ISC

Unpacked Size

5.95 kB

Total Files

3

Last publish

Collaborators

  • shangchenxu