mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Restructure fn helper
This commit is contained in:
13
api/src/utils/strip-function.ts
Normal file
13
api/src/utils/strip-function.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { REGEX_BETWEEN_PARENS } from '../constants';
|
||||
|
||||
/**
|
||||
* Strip the function declarations from a list of fields
|
||||
*/
|
||||
export function stripFunction(field: string): string {
|
||||
if (field.includes('(') && field.includes(')')) {
|
||||
console.log(field.match(REGEX_BETWEEN_PARENS));
|
||||
return field.match(REGEX_BETWEEN_PARENS)![1].trim();
|
||||
} else {
|
||||
return field;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user