Skip to content

Commit

Permalink
Use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 18, 2021
1 parent 10b898b commit 9491379
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
12 changes: 4 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
'use strict'

var toString = require('nlcst-to-string')
var visit = require('unist-util-visit')
var convert = require('unist-util-is/convert')

module.exports = sentenceSpacing
import toString from 'nlcst-to-string'
import visit from 'unist-util-visit'
import convert from 'unist-util-is/convert.js'

var sentence = convert('SentenceNode')
var whiteSpace = convert('WhiteSpaceNode')
Expand All @@ -13,7 +9,7 @@ var source = 'retext-sentence-spacing'
var ids = ['newline', 'space', 'double-space']
var expected = ['\n', ' ', ' ']

function sentenceSpacing(options) {
export default function retextSentenceSpacing(options) {
var preferred = (options || {}).preferred

if (preferred === null || preferred === undefined || preferred === 'space') {
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"files": [
"index.js"
],
Expand All @@ -37,7 +40,7 @@
"remark-preset-wooorm": "^8.0.0",
"retext": "^7.0.0",
"tape": "^5.0.0",
"xo": "^0.37.0"
"xo": "^0.39.0"
},
"scripts": {
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
Expand All @@ -55,8 +58,9 @@
},
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/prefer-type-error": "off"
}
Expand Down
8 changes: 3 additions & 5 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict'

var test = require('tape')
var retext = require('retext')
var spacing = require('.')
import test from 'tape'
import retext from 'retext'
import spacing from './index.js'

var mixed = [
'One sentence. Two sentences.',
Expand Down

0 comments on commit 9491379

Please sign in to comment.