Skip to content

Commit 2cfb6a7

Browse files
committed
Remove dependency
1 parent 5c22a0a commit 2cfb6a7

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Diff for: index.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import repeat from 'repeat-string'
21
import {longestStreak} from 'longest-streak'
32
import safe from 'mdast-util-to-markdown/lib/util/safe.js'
43

@@ -100,7 +99,7 @@ function exitMathData(token) {
10099

101100
function math(node, _, context) {
102101
var raw = node.value || ''
103-
var fence = repeat('$', Math.max(longestStreak(raw, '$') + 1, 2))
102+
var fence = '$'.repeat(Math.max(longestStreak(raw, '$') + 1, 2))
104103
var exit = context.enter('mathFlow')
105104
var value = fence
106105
var subexit
@@ -131,9 +130,7 @@ function inlineMath(node) {
131130
// If there is a single dollar sign on its own in the math, use a fence of
132131
// two.
133132
// If there are two in a row, use one.
134-
while (
135-
new RegExp('(^|[^$])' + repeat('\\$', size) + '([^$]|$)').test(value)
136-
) {
133+
while (new RegExp('(^|[^$])' + '\\$'.repeat(size) + '([^$]|$)').test(value)) {
137134
size++
138135
}
139136

@@ -147,7 +144,7 @@ function inlineMath(node) {
147144
pad = ' '
148145
}
149146

150-
sequence = repeat('$', size)
147+
sequence = '$'.repeat(size)
151148
return sequence + pad + value + pad + sequence
152149
}
153150

Diff for: package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
],
3535
"dependencies": {
3636
"longest-streak": "^3.0.0",
37-
"mdast-util-to-markdown": "^0.6.0",
38-
"repeat-string": "^1.0.0"
37+
"mdast-util-to-markdown": "^0.6.0"
3938
},
4039
"devDependencies": {
4140
"c8": "^7.0.0",

0 commit comments

Comments
 (0)