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

@mrtujiawei/utils

Package Overview
Dependencies
Maintainers
1
Versions
600
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mrtujiawei/utils - npm Package Compare versions

Comparing version 1.4.8 to 1.4.9

2

package.json
{
"name": "@mrtujiawei/utils",
"version": "1.4.8",
"version": "1.4.9",
"description": "把自己写的工具函数打包发布到npm上",

@@ -5,0 +5,0 @@ "types": "types/index.d.ts",

@@ -21,2 +21,4 @@ # @mrtujiawei/utils #

- [Queue](#queue)
- [Lock](#lock)
- [DateTimeTool](#datetimetool)

@@ -123,3 +125,3 @@ <!-- END doctoc generated TOC please keep comment here to allow auto update -->

```javascript
import { Queue, } from '@mrtujiawei/utils';
import { Queue } from '@mrtujiawei/utils';

@@ -143,1 +145,52 @@ const queue = new Queue();

```
### Lock ###
异步流程加锁
```javascript
import { Lock, sleep } from '@/mrtujiawei/utils';
const lock = new Lock(1);
/**
* 异步任务只有等上次任务结束后才会开始执行下一个异步任务
*/
const run = async (value, timeout) => {
try {
await lock.lock();
// 异步任务
await sleep(timeout);
console.log(value);
} finally {
lock.unLock();
}
};
run(0, 1000);
run(1, 100);
run(2, 0);
output: 0 1 2
```
<!--
### TaskQueue ###
-->
<!--
### ResponsibilityChain ###
-->
### DateTimeTool ###
日期时间处理类
解析时间太复杂,没做
```javascript
import { DateTimeTool } from '@/mrtujiawei/utils';
DateTimeTool.timeFormat(new Date(), ':'); // hh:mm:ss
DateTimeTool.dateFormat(new Date(), '-'); // yyyy-mm-dd
```
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