mizzkey/src/mfm/parse/elements/motion.ts

21 lines
340 B
TypeScript
Raw Normal View History

2018-08-05 12:33:51 +09:00
/**
* Motion
*/
export type TextElementMotion = {
type: 'motion'
content: string
motion: string
};
export default function(text: string) {
const match = text.match(/^\(\(\((.+?)\)\)\)/);
if (!match) return null;
const motion = match[0];
return {
type: 'motion',
content: motion,
motion: match[1]
} as TextElementMotion;
}