mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-10-14 15:53:55 +08:00
style: format
This commit is contained in:
@@ -7,25 +7,29 @@ export const dealRandomAssignees = (assignees: string, randomTo: string | void):
|
||||
arr = sampleSize(arr, Number(randomTo));
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
};
|
||||
|
||||
export const matchKeyword = (content: string, keywords: string[]): boolean => {
|
||||
return !!keywords.find(item => content.toLowerCase().includes(item));
|
||||
}
|
||||
};
|
||||
|
||||
export const checkDuplicate = (body: string | void): boolean => {
|
||||
if (!body || !body.startsWith('Duplicate of')) {
|
||||
return false;
|
||||
}
|
||||
const arr = body.split(' ');
|
||||
return arr[0] == 'Duplicate' && arr[1] == 'of'
|
||||
}
|
||||
return arr[0] == 'Duplicate' && arr[1] == 'of';
|
||||
};
|
||||
|
||||
export const getPreMonth = (m: number): number => {
|
||||
return m == 1 ? 12 : m - 1;
|
||||
}
|
||||
};
|
||||
|
||||
// replace some & split & cull empty
|
||||
export const replaceStr2Arr = (str: string, replace: string, split: string): string[] => {
|
||||
return str.replace(replace, '').trim().split(split).reduce((result: string[], it) => it ? [...result, it.trim()] : result, []);
|
||||
}
|
||||
return str
|
||||
.replace(replace, '')
|
||||
.trim()
|
||||
.split(split)
|
||||
.reduce((result: string[], it) => (it ? [...result, it.trim()] : result), []);
|
||||
};
|
||||
|
Reference in New Issue
Block a user