Refactoring
This commit is contained in:
parent
30f0b1c30d
commit
2e22874dec
4 changed files with 8 additions and 8 deletions
|
|
@ -46,7 +46,7 @@ export type TextElement = { type: 'text', content: string }
|
|||
| TextElementTitle
|
||||
| TextElementUrl
|
||||
| TextElementMotion;
|
||||
export type TextElementProcessor = (text: string, i: number) => TextElement | TextElement[];
|
||||
export type TextElementProcessor = (text: string, isBegin: boolean) => TextElement | TextElement[];
|
||||
|
||||
export default (source: string): TextElement[] => {
|
||||
if (source == null || source == '') {
|
||||
|
|
@ -67,7 +67,7 @@ export default (source: string): TextElement[] => {
|
|||
// パース
|
||||
while (source != '') {
|
||||
const parsed = elements.some(el => {
|
||||
let _tokens = el(source, i);
|
||||
let _tokens = el(source, i == 0);
|
||||
if (_tokens) {
|
||||
if (!Array.isArray(_tokens)) {
|
||||
_tokens = [_tokens];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue