New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

scxutils

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scxutils

工具函数

latest
npmnpm
Version
1.4.0
Version published
Maintainers
1
Created
Source

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);

FAQs

Package last updated on 03 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts