File tree Expand file tree Collapse file tree 4 files changed +11
-13
lines changed Expand file tree Collapse file tree 4 files changed +11
-13
lines changed Original file line number Diff line number Diff line change 66
77import { visit } from 'unist-util-visit'
88
9- var own = { } . hasOwnProperty
9+ const own = { } . hasOwnProperty
1010
1111/**
1212 *
1313 * @param {Node } node
1414 */
1515export function definitions ( node ) {
1616 /** @type {Object.<string, Definition> } */
17- var cache = Object . create ( null )
17+ const cache = Object . create ( null )
1818
1919 if ( ! node || ! node . type ) {
2020 throw new Error ( 'mdast-util-definitions expected node' )
@@ -26,7 +26,7 @@ export function definitions(node) {
2626
2727 /** @type {DefinitionVisitor } */
2828 function ondefinition ( definition ) {
29- var id = clean ( definition . identifier )
29+ const id = clean ( definition . identifier )
3030 if ( id && ! own . call ( cache , id ) ) {
3131 cache [ id ] = definition
3232 }
@@ -39,7 +39,7 @@ export function definitions(node) {
3939 * @returns {Definition|null }
4040 */
4141 function getDefinition ( identifier ) {
42- var id = clean ( identifier )
42+ const id = clean ( identifier )
4343 return id && own . call ( cache , id ) ? cache [ id ] : null
4444 }
4545}
Original file line number Diff line number Diff line change 7171 "xo" : {
7272 "prettier" : true ,
7373 "rules" : {
74- "capitalized-comments" : " off" ,
75- "no-var" : " off" ,
76- "prefer-arrow-callback" : " off"
74+ "capitalized-comments" : " off"
7775 }
7876 },
7977 "remarkConfig" : {
Original file line number Diff line number Diff line change @@ -26,12 +26,12 @@ npm install mdast-util-definitions
2626## Use
2727
2828``` js
29- import remark from ' remark'
29+ import { remark } from ' remark'
3030import {definitions } from ' mdast-util-definitions'
3131
32- var tree = remark ().parse (' [example]: https://example.com "Example"' )
32+ const tree = remark ().parse (' [example]: https://example.com "Example"' )
3333
34- var definition = definitions (tree)
34+ const definition = definitions (tree)
3535
3636definition (' example' )
3737// => {type: 'definition', 'title': 'Example', …}
Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ import test from 'tape'
66import remark from 'remark'
77import { definitions } from './index.js'
88
9- test ( 'mdast-util-definitions' , function ( t ) {
9+ test ( 'mdast-util-definitions' , ( t ) => {
1010 /** @type {Node } */
11- var tree
11+ let tree
1212
1313 t . throws (
14- function ( ) {
14+ ( ) => {
1515 // @ts -ignore runtime
1616 definitions ( )
1717 } ,
You can’t perform that action at this time.
0 commit comments