mirror of
https://github.com/documenso/documenso.git
synced 2025-11-16 17:51:49 +10:00
feat: wip
This commit is contained in:
17
packages/lib/utils/params.ts
Normal file
17
packages/lib/utils/params.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// Common util functions for parsing params.
|
||||
|
||||
/**
|
||||
* From an unknown string, parse it into a number array.
|
||||
*
|
||||
* Filter out unknown values.
|
||||
*/
|
||||
export const parseToNumberArray = (value: unknown): number[] => {
|
||||
if (typeof value !== 'string') {
|
||||
return [];
|
||||
}
|
||||
|
||||
return value
|
||||
.split(',')
|
||||
.map((value) => parseInt(value, 10))
|
||||
.filter((value) => !isNaN(value));
|
||||
};
|
||||
Reference in New Issue
Block a user