This commit is contained in:
29
node_modules/unist-util-position/index.js
generated
vendored
Normal file
29
node_modules/unist-util-position/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict'
|
||||
|
||||
var start = factory('start')
|
||||
var end = factory('end')
|
||||
|
||||
module.exports = position
|
||||
|
||||
position.start = start
|
||||
position.end = end
|
||||
|
||||
function position(node) {
|
||||
return {start: start(node), end: end(node)}
|
||||
}
|
||||
|
||||
function factory(type) {
|
||||
point.displayName = type
|
||||
|
||||
return point
|
||||
|
||||
function point(node) {
|
||||
var point = (node && node.position && node.position[type]) || {}
|
||||
|
||||
return {
|
||||
line: point.line || null,
|
||||
column: point.column || null,
|
||||
offset: isNaN(point.offset) ? null : point.offset
|
||||
}
|
||||
}
|
||||
}
|
||||
22
node_modules/unist-util-position/license
generated
vendored
Normal file
22
node_modules/unist-util-position/license
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
74
node_modules/unist-util-position/package.json
generated
vendored
Normal file
74
node_modules/unist-util-position/package.json
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"name": "unist-util-position",
|
||||
"version": "3.1.0",
|
||||
"description": "unist utility to get the position of a node",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"unist-util",
|
||||
"util",
|
||||
"utility",
|
||||
"node",
|
||||
"position",
|
||||
"point"
|
||||
],
|
||||
"repository": "syntax-tree/unist-util-position",
|
||||
"bugs": "https://github.com/syntax-tree/unist-util-position/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
},
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.0.0",
|
||||
"nyc": "^15.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.26.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
|
||||
"build-bundle": "browserify . -s unistUtilPosition > unist-util-position.js",
|
||||
"build-mangle": "browserify . -s unistUtilPosition -p tinyify > unist-util-position.min.js",
|
||||
"build": "npm run build-bundle && npm run build-mangle",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js",
|
||||
"test": "npm run format && npm run build && npm run test-coverage"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"ignores": [
|
||||
"unist-util-position.js"
|
||||
]
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
||||
123
node_modules/unist-util-position/readme.md
generated
vendored
Normal file
123
node_modules/unist-util-position/readme.md
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
# unist-util-position
|
||||
|
||||
[![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]
|
||||
|
||||
[**unist**][unist] utility to get the positional info of nodes.
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install unist-util-position
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
var remark = require('remark')
|
||||
var position = require('unist-util-position')
|
||||
|
||||
var tree = remark().parse('# foo\n\n* bar\n')
|
||||
|
||||
console.log(position(tree))
|
||||
console.log(position.start(tree))
|
||||
console.log(position.end(tree))
|
||||
|
||||
console.log(position())
|
||||
console.log(position.start())
|
||||
console.log(position.end())
|
||||
```
|
||||
|
||||
Yields:
|
||||
|
||||
```js
|
||||
{start: {line: 1, column: 1, offset: 0}, end: {line: 4, column: 1, offset: 13}}
|
||||
{line: 1, column: 1, offset: 0}
|
||||
{line: 4, column: 1, offset: 13}
|
||||
{start: {line: null, column: null, offset: null}, end: {line: null, column: null, offset: null}}
|
||||
{line: null, column: null, offset: null}
|
||||
{line: null, column: null, offset: null}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `position(node?)`
|
||||
|
||||
Get the positional info of `node` ([`Node?`][node]).
|
||||
Returns [`Position`][position].
|
||||
|
||||
### `position.start(node?)`
|
||||
|
||||
### `position.end(node?)`
|
||||
|
||||
Get the start or end points in the positional info of `node` ([`Node?`][node]).
|
||||
Returns [`Point`][point].
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
|
||||
started.
|
||||
See [`support.md`][support] for ways to get help.
|
||||
|
||||
This project has a [code of conduct][coc].
|
||||
By interacting with this repository, organization, or community you agree to
|
||||
abide by its terms.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://img.shields.io/travis/syntax-tree/unist-util-position.svg
|
||||
|
||||
[build]: https://travis-ci.org/syntax-tree/unist-util-position
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-position.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/unist-util-position
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/unist-util-position.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/unist-util-position
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/unist-util-position.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=unist-util-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/chat-spectrum-7b16ff.svg
|
||||
|
||||
[chat]: https://spectrum.chat/unified/syntax-tree
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[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
|
||||
|
||||
[node]: https://github.com/syntax-tree/unist#node
|
||||
|
||||
[position]: https://github.com/syntax-tree/unist#position
|
||||
|
||||
[point]: https://github.com/syntax-tree/unist#point
|
||||
Reference in New Issue
Block a user