Skip to content

Commit

Permalink
Refactor code-style
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Nov 7, 2022
1 parent b623a87 commit 96a77d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
8 changes: 4 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import rehypeParse from 'rehype-parse'
import {selectAll} from 'hast-util-select'
import {toString} from 'hast-util-to-string'

var endpoint =
const endpoint =
'https://www.readabilityformulas.com/articles/spache-formula-word-list.php'

https.get(endpoint, onresponse)
Expand All @@ -23,9 +23,9 @@ function onresponse(response) {
* @param {Buffer} buf
*/
function onconcat(buf) {
var tree = unified().use(rehypeParse).parse(buf)
const tree = unified().use(rehypeParse).parse(buf)

var values = selectAll('td p', tree)
const values = selectAll('td p', tree)
.map((/** @type {import('hast').Element} */ d) => toString(d))
.join('|')
.replace(/\\/g, "'")
Expand All @@ -44,7 +44,7 @@ function onconcat(buf) {

fs.writeFile(
'index.js',
'export var spache = ' + JSON.stringify(values, null, 2) + '\n',
'export const spache = ' + JSON.stringify(values, null, 2) + '\n',
bail
)
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export var spache = [
export const spache = [
'a',
'able',
'about',
Expand Down
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,7 @@
"trailingComma": "none"
},
"xo": {
"prettier": true,
"rules": {
"import/no-mutable-exports": "off",
"no-var": "off",
"prefer-arrow-callback": "off"
}
"prettier": true
},
"remarkConfig": {
"plugins": [
Expand Down

0 comments on commit 96a77d6

Please sign in to comment.