|
7 | 7 | * Resolver, |
8 | 8 | * State, |
9 | 9 | * TokenizeContext, |
10 | | - * Token, |
11 | | - * Tokenizer |
| 10 | + * Tokenizer, |
| 11 | + * Token |
12 | 12 | * } from 'micromark-util-types' |
13 | 13 | */ |
14 | 14 |
|
| 15 | +import {ok as assert} from 'devlop' |
15 | 16 | import {push, splice} from 'micromark-util-chunked' |
16 | 17 | import {classifyCharacter} from 'micromark-util-classify-character' |
17 | 18 | import {resolveAll} from 'micromark-util-resolve-all' |
18 | 19 | import {codes, constants, types} from 'micromark-util-symbol' |
19 | | -import {ok as assert} from 'devlop' |
20 | 20 |
|
21 | 21 | /** @type {Construct} */ |
22 | 22 | export const attention = { |
23 | 23 | name: 'attention', |
24 | | - tokenize: tokenizeAttention, |
25 | | - resolveAll: resolveAllAttention |
| 24 | + resolveAll: resolveAllAttention, |
| 25 | + tokenize: tokenizeAttention |
26 | 26 | } |
27 | 27 |
|
28 | 28 | /** |
@@ -99,34 +99,34 @@ function resolveAllAttention(events, context) { |
99 | 99 | ? 2 |
100 | 100 | : 1 |
101 | 101 |
|
102 | | - const start = Object.assign({}, events[open][1].end) |
103 | | - const end = Object.assign({}, events[index][1].start) |
| 102 | + const start = {...events[open][1].end} |
| 103 | + const end = {...events[index][1].start} |
104 | 104 | movePoint(start, -use) |
105 | 105 | movePoint(end, use) |
106 | 106 |
|
107 | 107 | openingSequence = { |
108 | 108 | type: use > 1 ? types.strongSequence : types.emphasisSequence, |
109 | 109 | start, |
110 | | - end: Object.assign({}, events[open][1].end) |
| 110 | + end: {...events[open][1].end} |
111 | 111 | } |
112 | 112 | closingSequence = { |
113 | 113 | type: use > 1 ? types.strongSequence : types.emphasisSequence, |
114 | | - start: Object.assign({}, events[index][1].start), |
| 114 | + start: {...events[index][1].start}, |
115 | 115 | end |
116 | 116 | } |
117 | 117 | text = { |
118 | 118 | type: use > 1 ? types.strongText : types.emphasisText, |
119 | | - start: Object.assign({}, events[open][1].end), |
120 | | - end: Object.assign({}, events[index][1].start) |
| 119 | + start: {...events[open][1].end}, |
| 120 | + end: {...events[index][1].start} |
121 | 121 | } |
122 | 122 | group = { |
123 | 123 | type: use > 1 ? types.strong : types.emphasis, |
124 | | - start: Object.assign({}, openingSequence.start), |
125 | | - end: Object.assign({}, closingSequence.end) |
| 124 | + start: {...openingSequence.start}, |
| 125 | + end: {...closingSequence.end} |
126 | 126 | } |
127 | 127 |
|
128 | | - events[open][1].end = Object.assign({}, openingSequence.start) |
129 | | - events[index][1].start = Object.assign({}, closingSequence.end) |
| 128 | + events[open][1].end = {...openingSequence.start} |
| 129 | + events[index][1].start = {...closingSequence.end} |
130 | 130 |
|
131 | 131 | nextEvents = [] |
132 | 132 |
|
@@ -204,6 +204,7 @@ function resolveAllAttention(events, context) { |
204 | 204 |
|
205 | 205 | /** |
206 | 206 | * @this {TokenizeContext} |
| 207 | + * Context. |
207 | 208 | * @type {Tokenizer} |
208 | 209 | */ |
209 | 210 | function tokenizeAttention(effects, ok) { |
@@ -286,8 +287,11 @@ function tokenizeAttention(effects, ok) { |
286 | 287 | * chunks (replacement characters, tabs, or line endings). |
287 | 288 | * |
288 | 289 | * @param {Point} point |
| 290 | + * Point. |
289 | 291 | * @param {number} offset |
| 292 | + * Amount to move. |
290 | 293 | * @returns {undefined} |
| 294 | + * Nothing. |
291 | 295 | */ |
292 | 296 | function movePoint(point, offset) { |
293 | 297 | point.column += offset |
|
0 commit comments