2018-11-03 22:38:12 +09:00

21 lines
385 B
TypeScript

/**
* Motion
*/
export type TextElementMotion = {
type: 'motion';
content: string;
motion: string;
};
export default function(text: string) {
const match = text.match(/^\(\(\((.+?)\)\)\)/) || text.match(/^<motion>(.+?)<\/motion>/);
if (!match) return null;
const motion = match[0];
return {
type: 'motion',
content: motion,
motion: match[1]
} as TextElementMotion;
}