unist-util-is
Advanced tools
Comparing version 4.0.4 to 4.1.0
@@ -40,3 +40,8 @@ // TypeScript Version: 3.5 | ||
*/ | ||
type Test<T extends Node> = TestType<T> | TestObject<T> | TestFunction<T> | ||
type Test<T extends Node> = | ||
| TestType<T> | ||
| TestObject<T> | ||
| TestFunction<T> | ||
| null | ||
| undefined | ||
} | ||
@@ -48,3 +53,3 @@ | ||
* @param node Node to check. | ||
* @param test When not given, checks if `node` is a `Node`. | ||
* @param test When nullish, checks if `node` is a `Node`. | ||
* When `string`, works like passing `function (node) {return node.type === test}`. | ||
@@ -62,3 +67,3 @@ * When `function` checks if function passed the node is true. | ||
node: unknown, | ||
test: unistUtilIs.Test<T> | Array<unistUtilIs.Test<any>>, | ||
test?: unistUtilIs.Test<T> | Array<unistUtilIs.Test<any>>, | ||
index?: number, | ||
@@ -65,0 +70,0 @@ parent?: Parent, |
{ | ||
"name": "unist-util-is", | ||
"version": "4.0.4", | ||
"version": "4.1.0", | ||
"description": "unist utility to check if a node passes a test", | ||
@@ -28,3 +28,4 @@ "license": "MIT", | ||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", | ||
"Christian Murphy <christian.murphy.42@gmail.com>" | ||
"Christian Murphy <christian.murphy.42@gmail.com>", | ||
"Lucas Brandstaetter <lucas@brandstaetter.tech> (https://github.com/Roang-zero1)" | ||
], | ||
@@ -38,3 +39,2 @@ "files": [ | ||
"types": "index.d.ts", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -44,2 +44,4 @@ "@types/mdast": "^3.0.0", | ||
"dtslint": "^4.0.0", | ||
"fast-check": "^2.0.0", | ||
"lodash": "^4.0.0", | ||
"nyc": "^15.0.0", | ||
@@ -52,3 +54,3 @@ "prettier": "^2.0.0", | ||
"unified": "^9.0.0", | ||
"xo": "^0.35.0" | ||
"xo": "^0.38.0" | ||
}, | ||
@@ -61,3 +63,3 @@ "scripts": { | ||
"test-api": "node test", | ||
"test-coverage": "nyc --reporter lcov tape test.js", | ||
"test-coverage": "nyc --reporter lcov tape test", | ||
"test-types": "dtslint .", | ||
@@ -88,4 +90,5 @@ "test": "npm run format && npm run build && npm run test-coverage && npm run test-types" | ||
"no-eq-null": "off", | ||
"unicorn/prefer-type-error": "off", | ||
"unicorn/prefer-reflect-apply": "off" | ||
"unicorn/prefer-number-properties": "off", | ||
"unicorn/prefer-reflect-apply": "off", | ||
"unicorn/prefer-type-error": "off" | ||
}, | ||
@@ -92,0 +95,0 @@ "ignore": [ |
@@ -56,3 +56,3 @@ # unist-util-is | ||
* `test` ([`Function`][test], `string`, `Object`, or `Array.<Test>`, optional) | ||
— When not given, checks if `node` is a [`Node`][node]. | ||
— When nullish, checks if `node` is a [`Node`][node]. | ||
When `string`, works like passing `node => node.type === test`. | ||
@@ -59,0 +59,0 @@ When `array`, checks if any one of the subtests pass. |
13746
150
13