This commit is contained in:
21
node_modules/hast-util-whitespace/index.js
generated
vendored
Normal file
21
node_modules/hast-util-whitespace/index.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = interElementWhiteSpace
|
||||
|
||||
// HTML white-space expression.
|
||||
// See <https://html.spec.whatwg.org/#space-character>.
|
||||
var re = /[ \t\n\f\r]/g
|
||||
|
||||
function interElementWhiteSpace(node) {
|
||||
var value
|
||||
|
||||
if (node && typeof node === 'object' && node.type === 'text') {
|
||||
value = node.value || ''
|
||||
} else if (typeof node === 'string') {
|
||||
value = node
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
return value.replace(re, '') === ''
|
||||
}
|
||||
22
node_modules/hast-util-whitespace/license
generated
vendored
Normal file
22
node_modules/hast-util-whitespace/license
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2016 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.
|
||||
78
node_modules/hast-util-whitespace/package.json
generated
vendored
Normal file
78
node_modules/hast-util-whitespace/package.json
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"name": "hast-util-whitespace",
|
||||
"version": "1.0.4",
|
||||
"description": "hast utility to check if a node is inter-element whitespace",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"unist",
|
||||
"hast",
|
||||
"hast-util",
|
||||
"util",
|
||||
"utility",
|
||||
"html",
|
||||
"inter",
|
||||
"element",
|
||||
"inter-element",
|
||||
"white-space",
|
||||
"whitespace"
|
||||
],
|
||||
"repository": "syntax-tree/hast-util-whitespace",
|
||||
"bugs": "https://github.com/syntax-tree/hast-util-whitespace/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.27.0"
|
||||
},
|
||||
"scripts": {
|
||||
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
|
||||
"build-bundle": "browserify . -s hastUtilWhitespace > hast-util-whitespace.js",
|
||||
"build-mangle": "browserify . -s hastUtilWhitespace -p tinyify > hast-util-whitespace.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"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
"ignores": [
|
||||
"hast-util-whitespace.js"
|
||||
]
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"preset-wooorm"
|
||||
]
|
||||
}
|
||||
}
|
||||
129
node_modules/hast-util-whitespace/readme.md
generated
vendored
Normal file
129
node_modules/hast-util-whitespace/readme.md
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
# hast-util-whitespace
|
||||
|
||||
[![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]
|
||||
|
||||
[**hast**][hast] utility to check if a `node` is [*inter-element
|
||||
whitespace*][spec].
|
||||
|
||||
## Install
|
||||
|
||||
[npm][]:
|
||||
|
||||
```sh
|
||||
npm install hast-util-whitespace
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```js
|
||||
var whitespace = require('hast-util-whitespace')
|
||||
|
||||
whitespace({
|
||||
type: 'element',
|
||||
tagName: 'div',
|
||||
children: []
|
||||
}) // => false
|
||||
|
||||
whitespace({
|
||||
type: 'text',
|
||||
value: '\t \n'
|
||||
}) // => true
|
||||
|
||||
whitespace({
|
||||
type: 'text',
|
||||
value: ' text\f'
|
||||
}) // => false
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `whitespace(node|value)`
|
||||
|
||||
Check if the given value is [*inter-element whitespace*][spec].
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `node` ([`Node`][node], optional) — Node to check
|
||||
* `value` (`string`, optional) — Value to check
|
||||
|
||||
###### Returns
|
||||
|
||||
`boolean` — Whether the `value` is inter-element white-space: consisting of zero
|
||||
or more of space, tab (`\t`), line feed (`\n`), carriage return (`\r`), or form
|
||||
feed (`\f`).
|
||||
If `node` is passed it must be a [*text*][text] node.
|
||||
|
||||
## Security
|
||||
|
||||
`hast-util-whitespace` does not change the syntax tree so there are no openings
|
||||
for [cross-site scripting (XSS)][xss] attacks.
|
||||
|
||||
## 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]
|
||||
|
||||
<!-- Definition -->
|
||||
|
||||
[build-badge]: https://img.shields.io/travis/syntax-tree/hast-util-whitespace.svg
|
||||
|
||||
[build]: https://travis-ci.org/syntax-tree/hast-util-whitespace
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-whitespace.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/syntax-tree/hast-util-whitespace
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/hast-util-whitespace.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/hast-util-whitespace
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/hast-util-whitespace.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=hast-util-whitespace
|
||||
|
||||
[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
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[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
|
||||
|
||||
[hast]: https://github.com/syntax-tree/hast
|
||||
|
||||
[spec]: https://html.spec.whatwg.org/#inter-element-whitespace
|
||||
|
||||
[node]: https://github.com/syntax-tree/hast#nodes
|
||||
|
||||
[text]: https://github.com/syntax-tree/hast#text
|
||||
|
||||
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
|
||||
Reference in New Issue
Block a user