1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-03 06:46:10 +02:00
Files
misskey/src/text/parse/elements/search.ts
2018-06-17 19:55:39 +09:00

20 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]
};
}