Socket
Socket
Sign inDemoInstall

mdast-util-definitions

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-definitions - npm Package Compare versions

Comparing version 3.0.1 to 4.0.0

10

index.js

@@ -15,3 +15,3 @@ 'use strict'

// Gather all definitions in `node`
function gather(node, options) {
function gather(node) {
var cache = {}

@@ -23,7 +23,7 @@

visit(node, 'definition', options && options.commonmark ? commonmark : normal)
visit(node, 'definition', ondefinition)
return cache
function commonmark(definition) {
function ondefinition(definition) {
var id = normalise(definition.identifier)

@@ -34,6 +34,2 @@ if (!own.call(cache, id)) {

}
function normal(definition) {
cache[normalise(definition.identifier)] = definition
}
}

@@ -40,0 +36,0 @@

{
"name": "mdast-util-definitions",
"version": "3.0.1",
"version": "4.0.0",
"description": "mdast utility to find definition nodes in a tree",

@@ -40,5 +40,5 @@ "license": "MIT",

"browserify": "^16.0.0",
"dtslint": "^3.0.0",
"dtslint": "^4.0.0",
"nyc": "^15.0.0",
"prettier": "^2.0.5",
"prettier": "^2.0.0",
"remark": "^12.0.0",

@@ -48,7 +48,7 @@ "remark-cli": "^8.0.0",

"tape": "^5.0.0",
"tinyify": "^2.0.0",
"xo": "^0.30.0"
"tinyify": "^3.0.0",
"xo": "^0.33.0"
},
"scripts": {
"format": "remark . -qfo && prettier --write . && xo --fix --ignore types",
"format": "remark . -qfo && prettier . --write && xo --fix --ignore types",
"build-bundle": "browserify . -s mdastUtilDefinitions > mdast-util-definitions.js",

@@ -55,0 +55,0 @@ "build-mangle": "browserify . -s mdastUtilDefinitions -p tinyify > mdast-util-definitions.min.js",

@@ -48,12 +48,9 @@ # mdast-util-definitions

### `definitions(node[, options])`
### `definitions(tree)`
Create a cache of all [definition][]s in [`node`][node].
Create a cache of all [definition][]s in [`tree`][node].
###### `options.commonmark`
Uses CommonMark precedence: prefers the first definitions for duplicate
definitions.
`boolean`, default: false — Turn on (`true`) to use CommonMark precedence:
ignore definitions found later for duplicate definitions.
The default behavior is to prefer the last found definition.
###### Returns

@@ -123,5 +120,5 @@

[chat-badge]: https://img.shields.io/badge/chat-spectrum-7b16ff.svg
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[chat]: https://spectrum.chat/unified/syntax-tree
[chat]: https://github.com/syntax-tree/unist/discussions

@@ -136,7 +133,7 @@ [license]: license

[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md
[contributing]: https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
[support]: https://github.com/syntax-tree/.github/blob/master/support.md
[support]: https://github.com/syntax-tree/.github/blob/HEAD/support.md
[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
[coc]: https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct.md

@@ -143,0 +140,0 @@ [mdast]: https://github.com/syntax-tree/mdast

@@ -6,11 +6,2 @@ // Minimum TypeScript Version: 3.2

declare namespace definitions {
interface Options {
/**
* Turn on (`true`) to use CommonMark precedence: ignore definitions found later for duplicate definitions. The default behavior is to prefer the last found definition.
*
* @default false
*/
commonmark: boolean
}
/**

@@ -25,7 +16,4 @@ * @param identifier [Identifier](https://github.com/syntax-tree/mdast#association) of [definition](https://github.com/syntax-tree/mdast#definition).

*/
declare function definitions(
node: Node,
options?: definitions.Options
): definitions.DefinitionCache
declare function definitions(node: Node): definitions.DefinitionCache
export = definitions
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc