Socket
Socket
Sign inDemoInstall

unist-util-find

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unist-util-find - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

17

index.d.ts

@@ -1,2 +0,3 @@

export default find;
declare const _exports: <V extends import("unist").Node<import("unist").Data>>(tree: Node, condition: TestStr | TestObj | TestFn) => V | undefined;
export = _exports;
export type Node = import('unist').Node;

@@ -17,15 +18,1 @@ /**

export type TestFn = <V extends import("unist").Node<import("unist").Data>>(node: V) => boolean;
/**
* Unist node finder utility.
*
* @param tree
* Node to search.
* @param condition
* Condition used to test each node.
* @returns
* The first node that matches condition, or undefined if no node matches.
* @type {<V extends Node>(tree: Node, condition: TestStr | TestObj | TestFn) => V | undefined}
*/
declare function find<V extends import("unist").Node<import("unist").Data>>(tree: import("unist").Node<import("unist").Data>, condition: string | {
[x: string]: unknown;
} | TestFn): V | undefined;

8

index.js

@@ -18,4 +18,4 @@ /**

import { visit } from 'unist-util-visit'
import iteratee from 'lodash.iteratee'
var visit = require('unist-util-visit')
var iteratee = require('lodash.iteratee')

@@ -33,3 +33,3 @@ /**

*/
function find (tree, condition) {
module.exports = function find (tree, condition) {
if (!tree) throw new Error('unist-util-find requires a tree to search')

@@ -50,3 +50,1 @@ if (!condition) throw new Error('unist-util-find requires a condition')

}
export default find
{
"name": "unist-util-find",
"version": "1.0.3",
"version": "1.0.4",
"description": "Unist node finder utility. Useful for working with remark, rehype and retext.",

@@ -14,11 +14,7 @@ "repository": "https://github.com/blahah/unist-util-find",

"scripts": {
"prepack": "npm run build",
"test": "standard && node test.js",
"build": "tsc",
"prepare": "npm run build",
"release": "release-it"
"build": "tsc"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"type": "module",
"type": "commonjs",
"keywords": [

@@ -40,5 +36,4 @@ "unist",

"@types/unist": "^2.0.6",
"release-it": "^15.11.0",
"remark": "^14.0.1",
"standard": "^16.0.4",
"remark": "^13.0.0",
"standard": "^8.0.0",
"tape": "^5.3.1",

@@ -49,4 +44,4 @@ "typescript": "^4.6.4"

"lodash.iteratee": "^4.7.0",
"unist-util-visit": "^4.1.0"
"unist-util-visit": "^2.0.0"
}
}
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