unist-util-stringify-position
Advanced tools
Comparing version 2.0.0 to 2.0.1
10
index.js
@@ -8,3 +8,3 @@ 'use strict' | ||
function stringify(value) { | ||
/* Nothing. */ | ||
// Nothing. | ||
if (!value || typeof value !== 'object') { | ||
@@ -14,3 +14,3 @@ return '' | ||
/* Node. */ | ||
// Node. | ||
if (own.call(value, 'position') || own.call(value, 'type')) { | ||
@@ -20,3 +20,3 @@ return position(value.position) | ||
/* Position. */ | ||
// Position. | ||
if (own.call(value, 'start') || own.call(value, 'end')) { | ||
@@ -26,3 +26,3 @@ return position(value) | ||
/* Point. */ | ||
// Point. | ||
if (own.call(value, 'line') || own.call(value, 'column')) { | ||
@@ -32,3 +32,3 @@ return point(value) | ||
/* ? */ | ||
// ? | ||
return '' | ||
@@ -35,0 +35,0 @@ } |
{ | ||
"name": "unist-util-stringify-position", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Stringify a Unist node, position, or point", | ||
@@ -33,11 +33,11 @@ "license": "MIT", | ||
"browserify": "^16.0.0", | ||
"dtslint": "^0.4.2", | ||
"nyc": "^13.0.0", | ||
"prettier": "^1.12.1", | ||
"dtslint": "^0.7.0", | ||
"nyc": "^14.0.0", | ||
"prettier": "^1.0.0", | ||
"remark-cli": "^6.0.0", | ||
"remark-preset-wooorm": "^4.0.0", | ||
"tape": "^4.5.1", | ||
"tinyify": "^2.4.3", | ||
"typescript": "^3.2.2", | ||
"xo": "^0.23.0" | ||
"remark-preset-wooorm": "^5.0.0", | ||
"tape": "^4.0.0", | ||
"tinyify": "^2.0.0", | ||
"typescript": "^3.0.0", | ||
"xo": "^0.24.0" | ||
}, | ||
@@ -71,7 +71,2 @@ "scripts": { | ||
"esnext": false, | ||
"rules": { | ||
"guard-for-in": "off", | ||
"no-var": "off", | ||
"prefer-arrow-callback": "off" | ||
}, | ||
"ignores": [ | ||
@@ -78,0 +73,0 @@ "unist-util-stringify-position.js" |
@@ -1,10 +0,18 @@ | ||
# unist-util-stringify-position [![Build Status][build-badge]][build-page] [![Coverage Status][coverage-badge]][coverage-page] | ||
# unist-util-stringify-position | ||
Stringify [unist\*\*][unist] [`Position`][position]s or [`Point`][point]s. | ||
[![Build][build-badge]][build] | ||
[![Coverage][coverage-badge]][coverage] | ||
[![Downloads][downloads-badge]][downloads] | ||
[![Size][size-badge]][size] | ||
[![Sponsors][sponsors-badge]][collective] | ||
[![Backers][backers-badge]][collective] | ||
[![Chat][chat-badge]][chat] | ||
## Installation | ||
[**unist**][unist] utility to pretty print the positional information of a node. | ||
## Install | ||
[npm][]: | ||
```bash | ||
```sh | ||
npm install unist-util-stringify-position | ||
@@ -15,3 +23,3 @@ ``` | ||
```javascript | ||
```js | ||
var stringify = require('unist-util-stringify-position') | ||
@@ -23,6 +31,3 @@ | ||
// Position | ||
stringify({ | ||
start: {line: 2}, | ||
end: {line: 3} | ||
}) // => '2:1-3:1' | ||
stringify({start: {line: 2}, end: {line: 3}}) // => '2:1-3:1' | ||
@@ -44,3 +49,4 @@ // Node | ||
Stringify one point, a position (start and end points), or a node’s position. | ||
Stringify one [point][], a [position][] (start and end [point][]s), or a node’s | ||
[positional information][positional-information]. | ||
@@ -64,9 +70,22 @@ ###### Parameters | ||
## Related | ||
* [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated) | ||
— Check if a node is generated | ||
* [`unist-util-position`](https://github.com/syntax-tree/unist-util-position) | ||
— Get positional info of nodes | ||
* [`unist-util-remove-position`](https://github.com/syntax-tree/unist-util-remove-position) | ||
— Remove positional info from trees | ||
* [`unist-util-source`](https://github.com/syntax-tree/unist-util-source) | ||
— Get the source of a value (node or position) in a file | ||
## Contribute | ||
See [`contributing.md` in `syntax-tree/unist`][contributing] for ways to get | ||
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get | ||
started. | ||
See [`support.md`][support] for ways to get help. | ||
This organisation has a [Code of Conduct][coc]. By interacting with this | ||
repository, organisation, or community you agree to abide by its terms. | ||
This project has a [Code of Conduct][coc]. | ||
By interacting with this repository, organisation, or community you agree to | ||
abide by its terms. | ||
@@ -81,8 +100,26 @@ ## License | ||
[build-page]: https://travis-ci.org/syntax-tree/unist-util-stringify-position | ||
[build]: https://travis-ci.org/syntax-tree/unist-util-stringify-position | ||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-stringify-position.svg | ||
[coverage-page]: https://codecov.io/github/syntax-tree/unist-util-stringify-position?branch=master | ||
[coverage]: https://codecov.io/github/syntax-tree/unist-util-stringify-position | ||
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-stringify-position.svg | ||
[downloads]: https://www.npmjs.com/package/unist-util-stringify-position | ||
[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-stringify-position.svg | ||
[size]: https://bundlephobia.com/result?p=unist-util-stringify-position | ||
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg | ||
[backers-badge]: https://opencollective.com/unified/backers/badge.svg | ||
[collective]: https://opencollective.com/unified | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg | ||
[chat]: https://spectrum.chat/unified/syntax-tree | ||
[npm]: https://docs.npmjs.com/cli/install | ||
@@ -94,2 +131,8 @@ | ||
[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md | ||
[support]: https://github.com/syntax-tree/.github/blob/master/support.md | ||
[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md | ||
[unist]: https://github.com/syntax-tree/unist | ||
@@ -103,4 +146,2 @@ | ||
[contributing]: https://github.com/syntax-tree/unist/blob/master/contributing.md | ||
[coc]: https://github.com/syntax-tree/unist/blob/master/code-of-conduct.md | ||
[positional-information]: https://github.com/syntax-tree/unist#positional-information |
8400
141