Skip to content

Commit

Permalink
Update dev-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Mar 23, 2020
1 parent b0dc98b commit 1c529a3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,26 @@
"src/index.js"
],
"dependencies": {
"extend": "^3.0.2",
"extend": "^3.0.0",
"unist-util-visit": "^1.0.1"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"ava": "2.0.0",
"ava": "3.0.0",
"babel-plugin-add-module-exports": "^1.0.0",
"browserify": "^16.0.0",
"nyc": "^14.0.0",
"prettier": "^1.0.0",
"nyc": "^15.0.0",
"prettier": "^2.0.0",
"remark": "^11.0.0",
"remark-cli": "^7.0.0",
"remark-html": "^10.0.0",
"remark-html": "^11.0.0",
"remark-preset-wooorm": "^6.0.0",
"remark-slug": "^5.0.0",
"remark-slug": "^6.0.0",
"tinyify": "^2.0.0",
"xo": "^0.24.0"
"xo": "^0.28.0"
},
"scripts": {
"prepublishOnly": "npm run compile",
Expand Down
24 changes: 10 additions & 14 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import slug from 'remark-slug'
import html from 'remark-html'
import headings from '..'

const base = file => read(join(__dirname, 'fixtures', file), 'utf-8')
const base = (file) => read(join(__dirname, 'fixtures', file), 'utf-8')
const behaviors = ['append', 'prepend', 'wrap']

test('should autolink headings', t => {
behaviors.forEach(b => {
test('should autolink headings', (t) => {
behaviors.forEach((b) => {
t.is(
remark()
.use(slug)
Expand All @@ -24,8 +24,8 @@ test('should autolink headings', t => {
})
})

test('should autolink headings with deprecated option', t => {
behaviors.forEach(b => {
test('should autolink headings with deprecated option', (t) => {
behaviors.forEach((b) => {
t.is(
remark()
.use(slug)
Expand All @@ -39,7 +39,7 @@ test('should autolink headings with deprecated option', t => {
})
})

test('should accept custom content', t => {
test('should accept custom content', (t) => {
t.is(
remark()
.use(slug)
Expand All @@ -51,7 +51,7 @@ test('should accept custom content', t => {
)
})

test('should accept custom content as an array', t => {
test('should accept custom content as an array', (t) => {
t.is(
remark()
.use(slug)
Expand All @@ -63,7 +63,7 @@ test('should accept custom content as an array', t => {
)
})

test('should accept link properties', t => {
test('should accept link properties', (t) => {
t.is(
remark()
.use(slug)
Expand All @@ -75,13 +75,9 @@ test('should accept link properties', t => {
)
})

test('should do nothing if slugs are not used', t => {
test('should do nothing if slugs are not used', (t) => {
t.is(
remark()
.use(headings)
.use(html)
.processSync(base('input.md'))
.toString(),
remark().use(headings).use(html).processSync(base('input.md')).toString(),
base('output.html')
)
})
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ const defaults = {behavior: 'prepend', content: contentDefaults}

let deprecationWarningIssued = false

export default function attacher(opts = {}) {
let {linkProperties, behavior, content} = {...defaults, ...opts}
export default function attacher(options = {}) {
let {linkProperties, behavior, content} = {...defaults, ...options}
let method
let hChildren

// NOTE: Remove in next major version
if (opts.behaviour !== undefined) {
if (options.behaviour !== undefined) {
if (!deprecationWarningIssued) {
deprecationWarningIssued = true
console.warn(
'[remark-autolink-headings] Deprecation Warning: `behaviour` is a nonstandard option. Use `behavior` instead.'
)
}

behavior = opts.behaviour
behavior = options.behaviour
}

if (behavior === 'wrap') {
Expand All @@ -41,7 +41,7 @@ export default function attacher(opts = {}) {
}
}

return ast => visit(ast, 'heading', visitor)
return (tree) => visit(tree, 'heading', visitor)

function visitor(node) {
const {data} = node
Expand Down

0 comments on commit 1c529a3

Please sign in to comment.