unist-util-generated
Advanced tools
Comparing version 1.1.5 to 1.1.6
19
index.js
@@ -6,11 +6,12 @@ 'use strict' | ||
function generated(node) { | ||
var position = optional(optional(node).position) | ||
var start = optional(position.start) | ||
var end = optional(position.end) | ||
return !start.line || !start.column || !end.line || !end.column | ||
return ( | ||
!node || | ||
!node.position || | ||
!node.position.start || | ||
!node.position.start.line || | ||
!node.position.start.column || | ||
!node.position.end || | ||
!node.position.end.line || | ||
!node.position.end.column | ||
) | ||
} | ||
function optional(value) { | ||
return value && typeof value === 'object' ? value : {} | ||
} |
{ | ||
"name": "unist-util-generated", | ||
"version": "1.1.5", | ||
"description": "Check if a Unist node is generated", | ||
"version": "1.1.6", | ||
"description": "unist utility to check if a node is generated", | ||
"license": "MIT", | ||
"keywords": [ | ||
"unist", | ||
"unist-util", | ||
"util", | ||
"utility", | ||
"position", | ||
"location", | ||
"generated", | ||
"util", | ||
"utility" | ||
"generated" | ||
], | ||
@@ -28,15 +29,15 @@ "repository": "syntax-tree/unist-util-generated", | ||
"devDependencies": { | ||
"browserify": "^16.0.0", | ||
"nyc": "^14.0.0", | ||
"prettier": "^1.0.0", | ||
"remark-cli": "^7.0.0", | ||
"remark-preset-wooorm": "^6.0.0", | ||
"tape": "^4.0.0", | ||
"tinyify": "^2.0.0", | ||
"xo": "^0.25.0" | ||
"browserify": "^17.0.0", | ||
"nyc": "^15.0.0", | ||
"prettier": "^2.0.0", | ||
"remark-cli": "^9.0.0", | ||
"remark-preset-wooorm": "^8.0.0", | ||
"tape": "^5.0.0", | ||
"tinyify": "^3.0.0", | ||
"xo": "^0.34.0" | ||
}, | ||
"scripts": { | ||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix", | ||
"build-bundle": "browserify . -s unistUtilGenerated > unist-util-generated.js", | ||
"build-mangle": "browserify . -s unistUtilGenerated -p tinyify > unist-util-generated.min.js", | ||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", | ||
"build-bundle": "browserify . -s unistUtilGenerated -o unist-util-generated.js", | ||
"build-mangle": "browserify . -s unistUtilGenerated -o unist-util-generated.min.js -p tinyify", | ||
"build": "npm run build-bundle && npm run build-mangle", | ||
@@ -43,0 +44,0 @@ "test-api": "node test", |
@@ -21,3 +21,3 @@ # unist-util-generated | ||
## Usage | ||
## Use | ||
@@ -54,2 +54,4 @@ ```js | ||
— Get the position of nodes | ||
* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source) | ||
— Get the source of a node or position | ||
* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) | ||
@@ -66,4 +68,4 @@ — Remove `position`s from a tree | ||
This project has a [Code of Conduct][coc]. | ||
By interacting with this repository, organisation, or community you agree to | ||
This project has a [code of conduct][coc]. | ||
By interacting with this repository, organization, or community you agree to | ||
abide by its terms. | ||
@@ -99,5 +101,5 @@ | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-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 | ||
@@ -110,7 +112,7 @@ [npm]: https://docs.npmjs.com/cli/install | ||
[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 | ||
@@ -117,0 +119,0 @@ [unist]: https://github.com/syntax-tree/unist |
6465
14
119