1
0
Fork 0
mirror of https://github.com/paricafe/misskey.git synced 2025-03-13 12:09:17 -05:00
paricafe/src/text/parse/elements/search.ts
2018-06-18 14:28:43 +09:00

19 lines
294 B
TypeScript

/**
* Search
*/
export type TextElementSearch = {
type: 'search'
content: string
query: string
};
export default function(text: string) {
const match = text.match(/^(.+?) 検索(\n|$)/);
if (!match) return null;
return {
type: 'search',
content: match[0],
query: match[1]
};
}