Skip to content

Commit 0a82230

Browse files
committed
replace last instance of String#slice with String#substring
1 parent fa12258 commit 0a82230

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ module.exports = function downdoc (asciidoc, { attributes: initialAttrs = {} } =
244244
}
245245
} else if (chr0 === '.') {
246246
subs = NORMAL_SUBS
247-
if (line !== chr0 && !(line[1] === '.' && line[2] === '.')) {
248-
const text = line[1] === '*' && line[line.length - 1] === '*' ? line.slice(2, -1) : line.substring(1)
247+
if (line !== chr0 && !(line[1] === '.' && line[2] === '.') && (match = line.length - 1)) {
248+
const text = line[1] === '*' && line[match] === '*' ? line.substring(2, match) : line.substring(1)
249249
blockTitle = (line = undefined) || { indent, text, subs }
250250
}
251251
} else if (indented) {

0 commit comments

Comments
 (0)