mdast-util-definitions
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -8,4 +8,4 @@ /** | ||
): (identifier: string) => Definition | null | ||
export type Node = import('unist').Node | ||
export type Node = import('mdast').Root | import('mdast').Content | ||
export type Definition = import('mdast').Definition | ||
export type DefinitionVisitor = import('unist-util-visit').Visitor<Definition> |
10
index.js
/** | ||
* @typedef {import('unist').Node} Node | ||
* @typedef {import('mdast').Root|import('mdast').Content} Node | ||
* @typedef {import('mdast').Definition} Definition | ||
@@ -9,3 +9,3 @@ * @typedef {import('unist-util-visit').Visitor<Definition>} DefinitionVisitor | ||
var own = {}.hasOwnProperty | ||
const own = {}.hasOwnProperty | ||
@@ -18,3 +18,3 @@ /** | ||
/** @type {Object.<string, Definition>} */ | ||
var cache = Object.create(null) | ||
const cache = Object.create(null) | ||
@@ -31,3 +31,3 @@ if (!node || !node.type) { | ||
function ondefinition(definition) { | ||
var id = clean(definition.identifier) | ||
const id = clean(definition.identifier) | ||
if (id && !own.call(cache, id)) { | ||
@@ -45,3 +45,3 @@ cache[id] = definition | ||
function getDefinition(identifier) { | ||
var id = clean(identifier) | ||
const id = clean(identifier) | ||
return id && own.call(cache, id) ? cache[id] : null | ||
@@ -48,0 +48,0 @@ } |
{ | ||
"name": "mdast-util-definitions", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "mdast utility to find definition nodes in a tree", | ||
@@ -53,3 +53,3 @@ "license": "MIT", | ||
"typescript": "^4.0.0", | ||
"xo": "^0.39.0" | ||
"xo": "^0.42.0" | ||
}, | ||
@@ -73,8 +73,3 @@ "scripts": { | ||
"xo": { | ||
"prettier": true, | ||
"rules": { | ||
"capitalized-comments": "off", | ||
"no-var": "off", | ||
"prefer-arrow-callback": "off" | ||
} | ||
"prettier": true | ||
}, | ||
@@ -81,0 +76,0 @@ "remarkConfig": { |
@@ -29,8 +29,8 @@ # mdast-util-definitions | ||
```js | ||
import remark from 'remark' | ||
import {remark} from 'remark' | ||
import {definitions} from 'mdast-util-definitions' | ||
var tree = remark().parse('[example]: https://example.com "Example"') | ||
const tree = remark().parse('[example]: https://example.com "Example"') | ||
var definition = definitions(tree) | ||
const definition = definitions(tree) | ||
@@ -37,0 +37,0 @@ definition('example') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8541