
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@dwing/common
Advanced tools
npm install @dwing/common --save
ES7:
const {md5} = require('@dwing/common');
console.log(md5('1'));
判断是否为数字
判断是否为对象
生成GUID
格式化时间
Name | Type | Description |
---|---|---|
`inputPattern` | string |
时间格式,默认为'yyyy-MM-dd hh:mm:ss' |
`inputDate` | any |
输入时间,默认为当前 |
格式化的时间
getDefer
defer对象
获取手机号码
Name | Type | Description |
---|---|---|
`mobile` | string |
手机号字符串 |
非手机号返回空字符串,否则返回去掉+86的手机号码
获取UNIX标准时间戳
UNIX标准时间戳
Hmac
Name | Type | Description |
---|---|---|
`str` | string |
待加密字符串 |
`type` | string |
sha1或sha256 |
`key` | string |
密钥 |
INT2IP
Name | Type | Description |
---|---|---|
`num` | int |
IP数值 |
IP地址,如1.2.3.4
IP2INT
Name | Type | Description |
---|---|---|
`ip` | str |
IP地址,如1.2.3.4 |
IP数值
判断是否为空
Name | Type | Description |
---|---|---|
`obj` | * |
任意 |
真为空,假为非空
判断是否为数字字符串
Name | Type | Description |
---|---|---|
`obj` | * |
任意 |
是否为数字字符串
MD5
Name | Type | Description |
---|---|---|
`str` | string |
Pad Numbers
Name | Type | Description |
---|---|---|
`n` | int |
数值 |
`len` | int |
补位长度 |
`char` | char |
补位字符,默认:0 |
IP地址,如1.2.3.4
随机数
Name | Type | Description |
---|---|---|
`m` | int |
m |
`n` | int |
n |
生成 m 到 n 的随机整数
随机数字字符串
Name | Type | Description |
---|---|---|
`len` | int |
字符串长度 |
const { randNumberStr } = require('@dwing/common'); const str = randNumberStr(6); console.log(str);
随机字符串
Name | Type | Description |
---|---|---|
`len` | int |
字符串长度 |
SHA1
Name | Type | Description |
---|---|---|
`str` | string |
SHA256
Name | Type | Description |
---|---|---|
`str` | string |
MIT
通过支付宝捐赠:
FAQs
security holding package
The npm package @dwing/common receives a total of 0 weekly downloads. As such, @dwing/common popularity was classified as not popular.
We found that @dwing/common demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.