faker
faker copied to clipboard
feat: add system.cron
Adds new functionality to generate cron expressions.
New Function:
- faker.system.cron()
Usage:
faker.system.cron()
:
// generates a random cron expression
console.log(faker.system.cron()): // '45 23 * * 6'
supports an optional options object, which currently has a year component
// generates a random cron expression with a year
console.log(faker.system.cron()): // '45 23 * * 6 2067'
Unit tests for the functions added.
Codecov Report
Merging #897 (e73eca9) into main (7f8b871) will decrease coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #897 +/- ##
==========================================
- Coverage 99.63% 99.62% -0.01%
==========================================
Files 2160 2160
Lines 240541 240614 +73
Branches 1014 1015 +1
==========================================
+ Hits 239652 239710 +58
- Misses 868 883 +15
Partials 21 21
Impacted Files | Coverage Δ | |
---|---|---|
src/modules/system/index.ts | 100.00% <100.00%> (ø) |
|
src/modules/internet/user-agent.ts | 82.53% <0.00%> (-3.97%) |
:arrow_down: |
Targeting it for v6.3, but I don't think it will make it so fast We plan to work on v7 in next "sprint"
Should we add some range for the cron: E.g. yearly
, daily
, ... (nothing precise, just some generaly direction)
Should we also try to generate some more advanced cron strings like 23 0-20/2 * * *?
i'd like to, I wanted to get the simplest expressions generated first and potentially gauge demand
@nhammond101 Could you please update this PR?
Please rebase your commits/PR:
git fetch --all
git rebase origin/main
git push -f
(assuming origin is the main faker repository)
Alternatively, we can do that for you, but then you have to reset your local checkout.
@Shinigami92 if you get a few minutes, would you post your approach?
if you get a few minutes, would you post your approach?
See here: https://github.com/faker-js/faker/pull/897#discussion_r956063709