mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 14:09:31 +02:00
refactor: simplify initial values handling and remove unused types in Crontab Guru tool
This commit is contained in:
@@ -7,9 +7,10 @@ import ToolTextResult from '@components/result/ToolTextResult';
|
|||||||
import { GetGroupsType } from '@components/options/ToolOptions';
|
import { GetGroupsType } from '@components/options/ToolOptions';
|
||||||
import { CardExampleType } from '@components/examples/ToolExamples';
|
import { CardExampleType } from '@components/examples/ToolExamples';
|
||||||
import { main, validateCrontab, explainCrontab } from './service';
|
import { main, validateCrontab, explainCrontab } from './service';
|
||||||
import { InitialValuesType } from './types';
|
|
||||||
|
|
||||||
const initialValues: InitialValuesType = {};
|
const initialValues = {};
|
||||||
|
|
||||||
|
type InitialValuesType = typeof initialValues;
|
||||||
|
|
||||||
const exampleCards: CardExampleType<InitialValuesType>[] = [
|
const exampleCards: CardExampleType<InitialValuesType>[] = [
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import { InitialValuesType } from './types';
|
|
||||||
import cronstrue from 'cronstrue';
|
import cronstrue from 'cronstrue';
|
||||||
import { isValidCron } from 'cron-validator';
|
import { isValidCron } from 'cron-validator';
|
||||||
|
|
||||||
@@ -14,7 +13,7 @@ export function validateCrontab(expr: string): boolean {
|
|||||||
return isValidCron(expr, { seconds: false, allowBlankDay: true });
|
return isValidCron(expr, { seconds: false, allowBlankDay: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function main(input: string, options: InitialValuesType): string {
|
export function main(input: string, _options: any): string {
|
||||||
if (!input.trim()) return '';
|
if (!input.trim()) return '';
|
||||||
if (!validateCrontab(input)) {
|
if (!validateCrontab(input)) {
|
||||||
return 'Invalid crontab expression.';
|
return 'Invalid crontab expression.';
|
||||||
|
@@ -1,4 +0,0 @@
|
|||||||
// Options for crontab-guru tool. Currently empty, but can be extended for advanced features.
|
|
||||||
export type InitialValuesType = {
|
|
||||||
// Add future options here
|
|
||||||
};
|
|
Reference in New Issue
Block a user