New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cao_tour

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cao_tour - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

29

dist/plugin/urlQuery.js

@@ -6,7 +6,5 @@

let param = 'school=gongda&hobby=skating&number=3'
let jsonObj = queryToObj(param)
console.log(jsonObj)
输出:{

@@ -61,5 +59,30 @@ school: 'gongda',

/*
直接取url中的参数转为json(或者不转)
用法:
let para = urlToJson()
console.log(para)
* */
function urlToJson () {
const url = window.location.href
const reg = /\?.*$/ // 正则取'?后的参数'
const urlMatch = url.match(reg)
// 匹配去掉?的纯参数(正则精髓,贪婪永远匹配最后一个?后的参数)
const param = urlMatch && urlMatch.length ? urlMatch[0].replace(/^\?*.*\?/, '') : ''
const output = {
paramStr: param,
paramJson: queryToObj(param)
}
return output
}
export {
queryToObj,
toQueryString
toQueryString,
urlToJson
}

2

package.json
{
"name": "cao_tour",
"version": "1.0.1",
"version": "1.0.2",
"description": "the useful function of js",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc