Skip to content

Commit

Permalink
Remove dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 22, 2021
1 parent a8213b5 commit 61418e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
14 changes: 6 additions & 8 deletions index.js
@@ -1,5 +1,3 @@
import repeat from 'repeat-string'

/**
* @typedef MarkdownTableOptions
* @property {string|string[]} [align]
Expand Down Expand Up @@ -127,7 +125,7 @@ export function markdownTable(table, options) {
longestCellByColumn[columnIndex] - before.length - after.length
)

cell = before + repeat('-', size) + after
cell = before + '-'.repeat(size) + after

if (settings.alignDelimiters !== false) {
size = before.length + size + after.length
Expand Down Expand Up @@ -166,17 +164,17 @@ export function markdownTable(table, options) {
code = alignments[columnIndex]

if (code === 114 /* `r` */) {
before = repeat(' ', size)
before = ' '.repeat(size)
} else if (code === 99 /* `c` */) {
if (size % 2) {
before = repeat(' ', size / 2 + 0.5)
after = repeat(' ', size / 2 - 0.5)
before = ' '.repeat(size / 2 + 0.5)
after = ' '.repeat(size / 2 - 0.5)
} else {
before = repeat(' ', size / 2)
before = ' '.repeat(size / 2)
after = before
}
} else {
after = repeat(' ', size)
after = ' '.repeat(size)
}
}

Expand Down
4 changes: 0 additions & 4 deletions package.json
Expand Up @@ -29,10 +29,6 @@
"index.d.ts",
"index.js"
],
"dependencies": {
"@types/repeat-string": "^1.0.0",
"repeat-string": "^1.0.0"
},
"devDependencies": {
"@types/tape": "^4.0.0",
"c8": "^7.0.0",
Expand Down

0 comments on commit 61418e7

Please sign in to comment.