cron-converter-u2q 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -59
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,100 +1,123 @@
|
|
|
1
1
|
# cron-converter-u2q
|
|
2
2
|
|
|
3
|
-

|
|
3
|
+
[](https://github.com/rahu619/cron-converter-u2q)
|
|
4
4
|
[](https://www.npmjs.com/package/cron-converter-u2q)
|
|
5
|
-

|
|
6
|
-

|
|
7
|
-

|
|
8
|
-

|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://github.com/rahu619/cron-converter-u2q/actions)
|
|
7
|
+
[](https://github.com/rahu619/cron-converter-u2q/actions)
|
|
8
|
+
[](https://www.typescriptlang.org/)
|
|
9
|
+
[](https://www.npmjs.com/package/cron-converter-u2q)
|
|
9
10
|
|
|
10
11
|
[](https://www.npmjs.com/package/cron-converter-u2q)
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
A powerful TypeScript library for working with cron expressions. Effortlessly convert between Unix and Quartz formats, generate human-readable descriptions, and validate cron expressions with ease.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
## ✨ Features
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
### 🔄 Two-way Conversion
|
|
18
|
+
- **Unix to Quartz**: Convert standard Unix cron expressions to Quartz format
|
|
19
|
+
- **Quartz to Unix**: Convert Quartz cron expressions to standard Unix format
|
|
20
|
+
- **Format Validation**: Built-in validation for both formats
|
|
21
|
+
- **Error Handling**: Clear error messages for invalid expressions
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
23
|
+
### 📝 Human-readable Descriptions
|
|
24
|
+
- **Natural Language**: Convert cron expressions to plain English
|
|
25
|
+
- **Multiple Languages**: Support for different language descriptions
|
|
26
|
+
- **Customizable**: Extend with your own description templates
|
|
27
|
+
- **Detailed**: Includes all schedule details (minutes, hours, days, etc.)
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
### 🛠️ Developer Friendly
|
|
30
|
+
- **TypeScript Support**: Full type definitions included
|
|
31
|
+
- **Zero Dependencies**: Lightweight and fast
|
|
32
|
+
- **Well Tested**: Comprehensive test coverage
|
|
33
|
+
- **ES6 Modules**: Support for both CommonJS and ES6 imports
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
-
|
|
35
|
+
### 🔍 Validation & Error Handling
|
|
36
|
+
- **Format Validation**: Ensures cron expressions are valid
|
|
37
|
+
- **Range Checking**: Validates field values within acceptable ranges
|
|
38
|
+
- **Clear Errors**: Descriptive error messages for debugging
|
|
39
|
+
- **Type Safety**: TypeScript types for better development experience
|
|
26
40
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Using npm:
|
|
41
|
+
## 📦 Installation
|
|
30
42
|
|
|
31
43
|
```bash
|
|
44
|
+
# Using npm
|
|
32
45
|
npm install cron-converter-u2q
|
|
33
|
-
```
|
|
34
46
|
|
|
35
|
-
Using yarn
|
|
36
|
-
|
|
37
|
-
```bash
|
|
47
|
+
# Using yarn
|
|
38
48
|
yarn add cron-converter-u2q
|
|
39
|
-
```
|
|
40
49
|
|
|
41
|
-
|
|
50
|
+
# Using pnpm
|
|
51
|
+
pnpm add cron-converter-u2q
|
|
52
|
+
```
|
|
42
53
|
|
|
43
|
-
|
|
54
|
+
## 🚀 Quick Start
|
|
44
55
|
|
|
45
|
-
```
|
|
46
|
-
|
|
56
|
+
```typescript
|
|
57
|
+
import { CronConverterU2Q } from 'cron-converter-u2q';
|
|
47
58
|
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
// Convert Unix to Quartz
|
|
60
|
+
const quartzExpression = CronConverterU2Q.unixToQuartz('5 * * * *');
|
|
61
|
+
console.log(quartzExpression); // "0 5 * * * ? *"
|
|
50
62
|
|
|
51
|
-
|
|
63
|
+
// Convert Quartz to Unix
|
|
64
|
+
const unixExpression = CronConverterU2Q.quartzToUnix('0 0 8 * * ?');
|
|
65
|
+
console.log(unixExpression); // "0 8 * * *"
|
|
52
66
|
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
// Get human-readable description
|
|
68
|
+
const description = CronConverterU2Q.describeUnix('*/5 * * * *');
|
|
69
|
+
console.log(description); // "Every 5 minutes"
|
|
55
70
|
```
|
|
56
71
|
|
|
57
|
-
|
|
72
|
+
## 📚 Examples
|
|
58
73
|
|
|
59
|
-
|
|
74
|
+
### Basic Conversions
|
|
60
75
|
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
#### Convert from Quartz to Unix:
|
|
76
|
+
```typescript
|
|
77
|
+
// Unix to Quartz
|
|
78
|
+
CronConverterU2Q.unixToQuartz('0 12 * * *'); // "0 0 12 * * ? *"
|
|
79
|
+
CronConverterU2Q.unixToQuartz('*/15 * * * *'); // "0 */15 * * * ? *"
|
|
66
80
|
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
// Quartz to Unix
|
|
82
|
+
CronConverterU2Q.quartzToUnix('0 0 8 * * ?'); // "0 8 * * *"
|
|
83
|
+
CronConverterU2Q.quartzToUnix('0 */5 * * * ?'); // "*/5 * * * *"
|
|
69
84
|
```
|
|
70
85
|
|
|
71
|
-
###
|
|
72
|
-
|
|
73
|
-
You can now generate human-readable descriptions for Unix and Quartz cron expressions.
|
|
86
|
+
### Human-readable Descriptions
|
|
74
87
|
|
|
75
|
-
|
|
88
|
+
```typescript
|
|
89
|
+
// Unix format descriptions
|
|
90
|
+
CronConverterU2Q.describeUnix('0 12 * * *'); // "At 12:00 PM"
|
|
91
|
+
CronConverterU2Q.describeUnix('*/15 * * * *'); // "Every 15 minutes"
|
|
76
92
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
93
|
+
// Quartz format descriptions
|
|
94
|
+
CronConverterU2Q.describeQuartz('0 0 8 * * ?'); // "At 8:00 AM"
|
|
95
|
+
CronConverterU2Q.describeQuartz('0 */5 * * * ?'); // "Every 5 minutes"
|
|
80
96
|
```
|
|
81
97
|
|
|
82
|
-
|
|
98
|
+
## 🤝 Contributing
|
|
83
99
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
101
|
+
|
|
102
|
+
1. Fork the repository
|
|
103
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
104
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
105
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
106
|
+
5. Open a Pull Request
|
|
107
|
+
|
|
108
|
+
## 📄 License
|
|
88
109
|
|
|
89
|
-
|
|
90
|
-
This project is licensed under the [MIT License](https://opensource.org/license/mit/)
|
|
110
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
91
111
|
|
|
112
|
+
## 💬 Support
|
|
92
113
|
|
|
93
|
-
|
|
94
|
-
|
|
114
|
+
- 📧 Email: rahu619@gmail.com
|
|
115
|
+
- 💻 GitHub Issues: [Create an issue](https://github.com/rahu619/cron-converter-u2q/issues)
|
|
116
|
+
- ⭐ Star the repository if you find it useful!
|
|
95
117
|
|
|
96
|
-
|
|
118
|
+
## 🙏 Acknowledgments
|
|
97
119
|
|
|
98
|
-
|
|
99
|
-
|
|
120
|
+
- Thanks to all contributors who have helped shape this project
|
|
121
|
+
- Inspired by the need for a simple, reliable cron expression converter
|
|
122
|
+
- Built with TypeScript for better developer experience
|
|
100
123
|
|