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

@xmini/qs

Package Overview
Dependencies
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xmini/qs

qs

  • 0.1.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
3
Weekly downloads
 
Created
Source

@xmini/qs

目标

  • 拿参数 支持获取完整的 url 搜索参数
  • 用于分享 支持输出标准的 url 格式数据
  • 兼容处理 微信分享后在 hash 前面自动添加参数,导致页面链接不规范
  • 支持参数的 merge 合并
  • 支持url 的映射转换

支持处理像这样不规整的URL,其query参数需要特殊处理

// 微信分享后在 hash 前面自动添加参数,导致页面链接不规范
https://m.iqianggou.com/?from=singlemessage&isappinstalled=0#bargain?id=646156&platform=5

Usage

  • copy 简单拷贝 JSON.parse(JSON.stringify(data));
  • compact 清除数组中的空数据,如 '', 0, undefined, false, NaN
  • compactObject 清除对象的无效数据,如 '', undefined, null
  • parse 解析 url 的 query 参数,输出为对象
  • stringify 对象转化为查询字符串
import {
  copy,
  compact,
  compactObject,
  parse,
  stringify,
} from '@xmini/qs';

// 非规范链接
const url = 'https://m.iqianggou.com/?from=singlemessage&isappinstalled=0#bargain?id=646156&platform=5'

const query = parse(url);

Keywords

FAQs

Package last updated on 03 Sep 2019

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

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