hast-util-phrasing
Advanced tools
Comparing version 1.0.0 to 1.0.1
30
index.js
@@ -1,19 +0,8 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2016 Titus Wormer | ||
* @license MIT | ||
* @module hast-util-phrasing | ||
* @fileoverview Check if a node is a phrasing content. | ||
*/ | ||
var is = require('hast-util-is-element') | ||
var has = require('hast-util-has-property') | ||
var embedded = require('hast-util-embedded') | ||
var bodyOKLink = require('hast-util-is-body-ok-link') | ||
/* Dependencies. */ | ||
var is = require('hast-util-is-element'); | ||
var has = require('hast-util-has-property'); | ||
var embedded = require('hast-util-embedded'); | ||
var bodyOKLink = require('hast-util-is-body-ok-link'); | ||
module.exports = phrasing | ||
/* Expose. */ | ||
module.exports = phrasing; | ||
/* Constants. */ | ||
var list = [ | ||
@@ -68,11 +57,12 @@ 'a', | ||
'wbr' | ||
]; | ||
] | ||
/* Check if `node` is phrasing content. */ | ||
function phrasing(node) { | ||
return node.type === 'text' || | ||
return ( | ||
node.type === 'text' || | ||
is(node, list) || | ||
embedded(node) || | ||
bodyOKLink(node) || | ||
(is(node, 'meta') && has(node, 'itemProp')); | ||
(is(node, 'meta') && has(node, 'itemProp')) | ||
) | ||
} |
{ | ||
"name": "hast-util-phrasing", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Check if a node is a phrasing content", | ||
@@ -14,4 +14,4 @@ "license": "MIT", | ||
], | ||
"repository": "https://github.com/wooorm/hast-util-phrasing", | ||
"bugs": "https://github.com/wooorm/hast-util-phrasing/issues", | ||
"repository": "syntax-tree/hast-util-phrasing", | ||
"bugs": "https://github.com/syntax-tree/hast-util-phrasing/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
@@ -21,5 +21,2 @@ "contributors": [ | ||
], | ||
"engines": { | ||
"node": ">=0.11.0" | ||
}, | ||
"files": [ | ||
@@ -35,21 +32,21 @@ "index.js" | ||
"devDependencies": { | ||
"browserify": "^13.0.0", | ||
"browserify": "^16.0.0", | ||
"esmangle": "^1.0.0", | ||
"hastscript": "^3.0.1", | ||
"nyc": "^8.3.0", | ||
"remark-cli": "^2.0.0", | ||
"remark-preset-wooorm": "^1.0.0", | ||
"nyc": "^12.0.0", | ||
"prettier": "^1.13.5", | ||
"remark-cli": "^5.0.0", | ||
"remark-preset-wooorm": "^4.0.0", | ||
"tape": "^4.4.0", | ||
"unist-builder": "^1.0.2", | ||
"xo": "^0.16.0" | ||
"xo": "^0.21.0" | ||
}, | ||
"scripts": { | ||
"build-md": "remark . --quiet --frail", | ||
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", | ||
"build-bundle": "browserify index.js -s hastUtilPhrasing > hast-util-phrasing.js", | ||
"build-mangle": "esmangle hast-util-phrasing.js > hast-util-phrasing.min.js", | ||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", | ||
"lint": "xo", | ||
"build": "npm run build-bundle && npm run build-mangle", | ||
"test-api": "node test", | ||
"test-coverage": "nyc --reporter lcov tape test.js", | ||
"test": "npm run build && npm run lint && npm run test-coverage" | ||
"test": "npm run format && npm run build && npm run test-coverage" | ||
}, | ||
@@ -62,4 +59,13 @@ "nyc": { | ||
}, | ||
"prettier": { | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"semi": false, | ||
"trailingComma": "none" | ||
}, | ||
"xo": { | ||
"space": true, | ||
"prettier": true, | ||
"esnext": false, | ||
"ignores": [ | ||
@@ -70,5 +76,6 @@ "hast-util-phrasing.js" | ||
"remarkConfig": { | ||
"output": true, | ||
"presets": "wooorm" | ||
"plugins": [ | ||
"preset-wooorm" | ||
] | ||
} | ||
} |
@@ -7,3 +7,3 @@ # hast-util-phrasing [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] | ||
[npm][npm-install]: | ||
[npm][]: | ||
@@ -17,4 +17,3 @@ ```bash | ||
```javascript | ||
// Dependencies: | ||
var phrasing = require('hast-util-phrasing'); | ||
var phrasing = require('.') | ||
@@ -26,4 +25,4 @@ // Given flow content: | ||
children: [{type: 'text', value: 'Alpha'}] | ||
}); | ||
//=> false | ||
}) | ||
// => false | ||
@@ -36,4 +35,4 @@ // Given a phrasing element: | ||
children: [] | ||
}); | ||
//=> true | ||
}) | ||
// => true | ||
@@ -46,8 +45,8 @@ // Given a non-phrasing element: | ||
children: [] | ||
}); | ||
//=> false | ||
}) | ||
// => false | ||
// Given text: | ||
phrasing({type: 'text', value: 'Delta'}); | ||
//=> true | ||
phrasing({type: 'text', value: 'Delta'}) | ||
// => true | ||
``` | ||
@@ -57,10 +56,22 @@ | ||
### `transparent(node)` | ||
### `phrasing(node)` | ||
Check if the given value is a [**phrasing**][spec] content. | ||
**Parameters**: `node` (`*`) — Value to check. | ||
###### Parameters | ||
**Returns**: `boolean`, whether `node` passes the test. | ||
* `node` (`*`) — Value to check. | ||
###### Returns | ||
`boolean` — Whether `node` passes the test. | ||
## Contribute | ||
See [`contributing.md` in `syntax-tree/hast`][contributing] for ways to get | ||
started. | ||
This organisation has a [Code of Conduct][coc]. By interacting with this | ||
repository, organisation, or community you agree to abide by its terms. | ||
## License | ||
@@ -72,11 +83,11 @@ | ||
[travis-badge]: https://img.shields.io/travis/wooorm/hast-util-phrasing.svg | ||
[travis-badge]: https://img.shields.io/travis/syntax-tree/hast-util-phrasing.svg | ||
[travis]: https://travis-ci.org/wooorm/hast-util-phrasing | ||
[travis]: https://travis-ci.org/syntax-tree/hast-util-phrasing | ||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/hast-util-phrasing.svg | ||
[codecov-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-phrasing.svg | ||
[codecov]: https://codecov.io/github/wooorm/hast-util-phrasing | ||
[codecov]: https://codecov.io/github/syntax-tree/hast-util-phrasing | ||
[npm-install]: https://docs.npmjs.com/cli/install | ||
[npm]: https://docs.npmjs.com/cli/install | ||
@@ -87,4 +98,8 @@ [license]: LICENSE | ||
[node]: https://github.com/wooorm/hast#node | ||
[node]: https://github.com/syntax-tree/hast | ||
[spec]: https://html.spec.whatwg.org/#phrasing-content-2 | ||
[contributing]: https://github.com/syntax-tree/hast/blob/master/contributing.md | ||
[coc]: https://github.com/syntax-tree/hast/blob/master/code-of-conduct.md |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
6108
98
10
64