mirror of https://github.com/lukechilds/node.git
Browse Source
* Install eslint-plugin-markdown@1.0.0-beta.7 * Add doc/.eslintrc.yaml * Add `plugins: [markdown]` to the main .eslintrc.yaml * .js files in doc folder added to .eslintignore * Update Makefile, vcbuild.bat, and tools/jslint.js Refs: https://github.com/nodejs/node/pull/12563 Refs: https://github.com/nodejs/node/pull/12640 Refs: https://github.com/nodejs/node/pull/14047 PR-URL: https://github.com/nodejs/node/pull/14067 Reviewed-By: James Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>v6.x
Vse Mozhet Byt
8 years ago
committed by
Myles Borins
208 changed files with 19279 additions and 6 deletions
@ -0,0 +1,12 @@ |
|||
## Docs-specific linter rules |
|||
|
|||
rules: |
|||
# ease some restrictions in doc examples |
|||
no-restricted-properties: 0 |
|||
no-undef: 0 |
|||
no-unused-vars: 0 |
|||
strict: 0 |
|||
|
|||
# add new ECMAScript features gradually |
|||
no-var: 2 |
|||
prefer-const: 2 |
@ -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. |
@ -0,0 +1,12 @@ |
|||
<!--remark setext--> |
|||
|
|||
<!--lint disable no-multiple-toplevel-headings--> |
|||
|
|||
1.0.1 / 2016-07-23 |
|||
================== |
|||
|
|||
* Rewrite module ([`75e6d41`](https://github.com/wooorm/bail/commit/75e6d41)) |
|||
* Update dev-dependencies ([`9ec98f9`](https://github.com/wooorm/bail/commit/9ec98f9)) |
|||
|
|||
1.0.0 / 2015-07-28 |
|||
================== |
@ -0,0 +1,34 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2015 Titus Wormer |
|||
* @license MIT |
|||
* @module bail |
|||
* @fileoverview Throw a given error. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
/* Expose. */ |
|||
module.exports = bail; |
|||
|
|||
/** |
|||
* Throw a given error. |
|||
* |
|||
* @example |
|||
* bail(); |
|||
* |
|||
* @example |
|||
* bail(new Error('failure')); |
|||
* // Error: failure
|
|||
* // at repl:1:6
|
|||
* // at REPLServer.defaultEval (repl.js:154:27)
|
|||
* // ...
|
|||
* |
|||
* @param {Error?} [err] - Optional error. |
|||
* @throws {Error} - `err`, when given. |
|||
*/ |
|||
function bail(err) { |
|||
if (err) { |
|||
throw err; |
|||
} |
|||
} |
@ -0,0 +1,103 @@ |
|||
{ |
|||
"_from": "bail@^1.0.0", |
|||
"_id": "bail@1.0.1", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-kSV53os5Gq3zxf30zSoPwiXfO8I=", |
|||
"_location": "/bail", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "bail@^1.0.0", |
|||
"name": "bail", |
|||
"escapedName": "bail", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/unified" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/bail/-/bail-1.0.1.tgz", |
|||
"_shasum": "912579de8b391aadf3c5fdf4cd2a0fc225df3bc2", |
|||
"_spec": "bail@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unified", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/bail/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "Throw a given error", |
|||
"devDependencies": { |
|||
"browserify": "^13.0.1", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^7.0.0", |
|||
"remark-cli": "^1.0.0", |
|||
"remark-comment-config": "^4.0.0", |
|||
"remark-github": "^5.0.0", |
|||
"remark-lint": "^4.0.0", |
|||
"remark-validate-links": "^4.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.16.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/wooorm/bail#readme", |
|||
"keywords": [ |
|||
"fail", |
|||
"bail", |
|||
"throw", |
|||
"callback", |
|||
"error" |
|||
], |
|||
"license": "MIT", |
|||
"name": "bail", |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"plugins": [ |
|||
"comment-config", |
|||
"github", |
|||
"lint", |
|||
"validate-links" |
|||
], |
|||
"settings": { |
|||
"bullet": "*" |
|||
} |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/bail.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.js --bare -s bail > bail.js", |
|||
"build-mangle": "esmangle bail.js > bail.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.0.1", |
|||
"xo": { |
|||
"space": true, |
|||
"ignores": [ |
|||
"bail.js", |
|||
"bail.min.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,73 @@ |
|||
# bail [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
<!--lint disable heading-increment list-item-spacing--> |
|||
|
|||
:warning: Throw a given error. |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install bail |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```js |
|||
var bail = require('bail'); |
|||
|
|||
bail(); |
|||
|
|||
bail(new Error('failure')); |
|||
// Error: failure |
|||
// at repl:1:6 |
|||
// at REPLServer.defaultEval (repl.js:154:27) |
|||
// ... |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `bail([err])` |
|||
|
|||
Throw a given error. |
|||
|
|||
###### Parameters |
|||
|
|||
* `err` (`Error?`) — Optional error. |
|||
|
|||
###### Throws |
|||
|
|||
* `Error` — Given error, if any. |
|||
|
|||
## Related |
|||
|
|||
* [`noop`][noop]; |
|||
* [`noop2`][noop2]; |
|||
* [`noop3`][noop3]; |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/bail.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/bail |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/bail.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/bail |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
|||
|
|||
[noop]: https://www.npmjs.com/package/noop |
|||
|
|||
[noop2]: https://www.npmjs.com/package/noop2 |
|||
|
|||
[noop3]: https://www.npmjs.com/package/noop3 |
@ -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. |
@ -0,0 +1,108 @@ |
|||
{ |
|||
"AElig": "Æ", |
|||
"AMP": "&", |
|||
"Aacute": "Á", |
|||
"Acirc": "Â", |
|||
"Agrave": "À", |
|||
"Aring": "Å", |
|||
"Atilde": "Ã", |
|||
"Auml": "Ä", |
|||
"COPY": "©", |
|||
"Ccedil": "Ç", |
|||
"ETH": "Ð", |
|||
"Eacute": "É", |
|||
"Ecirc": "Ê", |
|||
"Egrave": "È", |
|||
"Euml": "Ë", |
|||
"GT": ">", |
|||
"Iacute": "Í", |
|||
"Icirc": "Î", |
|||
"Igrave": "Ì", |
|||
"Iuml": "Ï", |
|||
"LT": "<", |
|||
"Ntilde": "Ñ", |
|||
"Oacute": "Ó", |
|||
"Ocirc": "Ô", |
|||
"Ograve": "Ò", |
|||
"Oslash": "Ø", |
|||
"Otilde": "Õ", |
|||
"Ouml": "Ö", |
|||
"QUOT": "\"", |
|||
"REG": "®", |
|||
"THORN": "Þ", |
|||
"Uacute": "Ú", |
|||
"Ucirc": "Û", |
|||
"Ugrave": "Ù", |
|||
"Uuml": "Ü", |
|||
"Yacute": "Ý", |
|||
"aacute": "á", |
|||
"acirc": "â", |
|||
"acute": "´", |
|||
"aelig": "æ", |
|||
"agrave": "à", |
|||
"amp": "&", |
|||
"aring": "å", |
|||
"atilde": "ã", |
|||
"auml": "ä", |
|||
"brvbar": "¦", |
|||
"ccedil": "ç", |
|||
"cedil": "¸", |
|||
"cent": "¢", |
|||
"copy": "©", |
|||
"curren": "¤", |
|||
"deg": "°", |
|||
"divide": "÷", |
|||
"eacute": "é", |
|||
"ecirc": "ê", |
|||
"egrave": "è", |
|||
"eth": "ð", |
|||
"euml": "ë", |
|||
"frac12": "½", |
|||
"frac14": "¼", |
|||
"frac34": "¾", |
|||
"gt": ">", |
|||
"iacute": "í", |
|||
"icirc": "î", |
|||
"iexcl": "¡", |
|||
"igrave": "ì", |
|||
"iquest": "¿", |
|||
"iuml": "ï", |
|||
"laquo": "«", |
|||
"lt": "<", |
|||
"macr": "¯", |
|||
"micro": "µ", |
|||
"middot": "·", |
|||
"nbsp": " ", |
|||
"not": "¬", |
|||
"ntilde": "ñ", |
|||
"oacute": "ó", |
|||
"ocirc": "ô", |
|||
"ograve": "ò", |
|||
"ordf": "ª", |
|||
"ordm": "º", |
|||
"oslash": "ø", |
|||
"otilde": "õ", |
|||
"ouml": "ö", |
|||
"para": "¶", |
|||
"plusmn": "±", |
|||
"pound": "£", |
|||
"quot": "\"", |
|||
"raquo": "»", |
|||
"reg": "®", |
|||
"sect": "§", |
|||
"shy": "", |
|||
"sup1": "¹", |
|||
"sup2": "²", |
|||
"sup3": "³", |
|||
"szlig": "ß", |
|||
"thorn": "þ", |
|||
"times": "×", |
|||
"uacute": "ú", |
|||
"ucirc": "û", |
|||
"ugrave": "ù", |
|||
"uml": "¨", |
|||
"uuml": "ü", |
|||
"yacute": "ý", |
|||
"yen": "¥", |
|||
"yuml": "ÿ" |
|||
} |
@ -0,0 +1,97 @@ |
|||
{ |
|||
"_from": "character-entities-legacy@^1.0.0", |
|||
"_id": "character-entities-legacy@1.1.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-sYqtmPa3vMZGweTIH58ZVjdqVho=", |
|||
"_location": "/character-entities-legacy", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "character-entities-legacy@^1.0.0", |
|||
"name": "character-entities-legacy", |
|||
"escapedName": "character-entities-legacy", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/parse-entities" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.0.tgz", |
|||
"_shasum": "b18aad98f6b7bcc646c1e4c81f9f1956376a561a", |
|||
"_spec": "character-entities-legacy@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\parse-entities", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/character-entities-legacy/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "HTML legacy character entity information", |
|||
"devDependencies": { |
|||
"bail": "^1.0.1", |
|||
"browserify": "^13.0.1", |
|||
"concat-stream": "^1.5.2", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^8.0.0", |
|||
"remark-cli": "^2.0.0", |
|||
"remark-preset-wooorm": "^1.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.17.0" |
|||
}, |
|||
"files": [ |
|||
"index.json" |
|||
], |
|||
"homepage": "https://github.com/wooorm/character-entities-legacy#readme", |
|||
"keywords": [ |
|||
"html", |
|||
"entity", |
|||
"entities", |
|||
"character", |
|||
"reference", |
|||
"name", |
|||
"replacement" |
|||
], |
|||
"license": "MIT", |
|||
"main": "index.json", |
|||
"name": "character-entities-legacy", |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"presets": "wooorm" |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/character-entities-legacy.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-generate && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.json --bare -s characterEntitiesLegacy > character-entities-legacy.js", |
|||
"build-generate": "node build", |
|||
"build-mangle": "esmangle character-entities-legacy.js > character-entities-legacy.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.1.0", |
|||
"xo": { |
|||
"space": true, |
|||
"ignores": [ |
|||
"character-entities-legacy.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,54 @@ |
|||
# character-entities-legacy [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
HTML legacy character entity information: for legacy reasons some |
|||
character entities are not required to have a trailing semicolon: |
|||
`©` is perfectly okay for `©`. |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install character-entities-legacy |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```js |
|||
console.log(characterEntitiesLegacy.copy); // © |
|||
console.log(characterEntitiesLegacy.frac34); // ¾ |
|||
console.log(characterEntitiesLegacy.sup1); // ¹ |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `characterEntitiesLegacy` |
|||
|
|||
Mapping between (case-sensitive) legacy character entity names to |
|||
replacements. |
|||
|
|||
## Support |
|||
|
|||
See [whatwg/html][html]. |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/character-entities-legacy.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/character-entities-legacy |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/character-entities-legacy.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/character-entities-legacy |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
|||
|
|||
[html]: https://raw.githubusercontent.com/whatwg/html/master/json-entities-legacy.inc |
@ -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. |
File diff suppressed because it is too large
@ -0,0 +1,97 @@ |
|||
{ |
|||
"_from": "character-entities@^1.0.0", |
|||
"_id": "character-entities@1.2.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-poPiz3Xb6LFxljUxNk5Y4YobFV8=", |
|||
"_location": "/character-entities", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "character-entities@^1.0.0", |
|||
"name": "character-entities", |
|||
"escapedName": "character-entities", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/parse-entities" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.0.tgz", |
|||
"_shasum": "a683e2cf75dbe8b171963531364e58e18a1b155f", |
|||
"_spec": "character-entities@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\parse-entities", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/character-entities/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "HTML character entity information", |
|||
"devDependencies": { |
|||
"bail": "^1.0.1", |
|||
"browserify": "^13.0.1", |
|||
"concat-stream": "^1.5.2", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^8.0.0", |
|||
"remark-cli": "^2.0.0", |
|||
"remark-preset-wooorm": "^1.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.17.0" |
|||
}, |
|||
"files": [ |
|||
"index.json" |
|||
], |
|||
"homepage": "https://github.com/wooorm/character-entities#readme", |
|||
"keywords": [ |
|||
"html", |
|||
"entity", |
|||
"entities", |
|||
"character", |
|||
"reference", |
|||
"name", |
|||
"replacement" |
|||
], |
|||
"license": "MIT", |
|||
"main": "index.json", |
|||
"name": "character-entities", |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"presets": "wooorm" |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/character-entities.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-generate && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.json --bare -s characterEntities > character-entities.js", |
|||
"build-generate": "node build", |
|||
"build-mangle": "esmangle character-entities.js > character-entities.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.2.0", |
|||
"xo": { |
|||
"space": true, |
|||
"ignores": [ |
|||
"character-entities.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,53 @@ |
|||
# character-entities [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
<!--lint disable heading-increment list-item-spacing no-duplicate-headings--> |
|||
|
|||
HTML character entity information. |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install character-entities |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```js |
|||
console.log(characterEntities.AElig); // Æ |
|||
console.log(characterEntities.aelig); // æ |
|||
console.log(characterEntities.amp); // & |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### characterEntities |
|||
|
|||
Mapping between (case-sensitive) character entity names to replacements. |
|||
|
|||
## Support |
|||
|
|||
See [html.spec.whatwg.org][html]. |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/character-entities.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/character-entities |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/character-entities.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/character-entities |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
|||
|
|||
[html]: https://html.spec.whatwg.org/multipage/syntax.html#named-character-references |
@ -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. |
@ -0,0 +1,30 @@ |
|||
{ |
|||
"0": "�", |
|||
"128": "€", |
|||
"130": "‚", |
|||
"131": "ƒ", |
|||
"132": "„", |
|||
"133": "…", |
|||
"134": "†", |
|||
"135": "‡", |
|||
"136": "ˆ", |
|||
"137": "‰", |
|||
"138": "Š", |
|||
"139": "‹", |
|||
"140": "Œ", |
|||
"142": "Ž", |
|||
"145": "‘", |
|||
"146": "’", |
|||
"147": "“", |
|||
"148": "”", |
|||
"149": "•", |
|||
"150": "–", |
|||
"151": "—", |
|||
"152": "˜", |
|||
"153": "™", |
|||
"154": "š", |
|||
"155": "›", |
|||
"156": "œ", |
|||
"158": "ž", |
|||
"159": "Ÿ" |
|||
} |
@ -0,0 +1,101 @@ |
|||
{ |
|||
"_from": "character-reference-invalid@^1.0.0", |
|||
"_id": "character-reference-invalid@1.1.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-3smtHfufjQa0/NqircPE/ZevHmg=", |
|||
"_location": "/character-reference-invalid", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "character-reference-invalid@^1.0.0", |
|||
"name": "character-reference-invalid", |
|||
"escapedName": "character-reference-invalid", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/parse-entities" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.0.tgz", |
|||
"_shasum": "dec9ad1dfb9f8d06b4fcdaa2adc3c4fd97af1e68", |
|||
"_spec": "character-reference-invalid@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\parse-entities", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/character-reference-invalid/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "HTML invalid numeric character reference information", |
|||
"devDependencies": { |
|||
"bail": "^1.0.1", |
|||
"browserify": "^13.0.1", |
|||
"esmangle": "^1.0.1", |
|||
"jsdom": "^9.4.1", |
|||
"nyc": "^8.0.0", |
|||
"remark-cli": "^2.0.0", |
|||
"remark-preset-wooorm": "^1.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.17.0" |
|||
}, |
|||
"files": [ |
|||
"index.json" |
|||
], |
|||
"homepage": "https://github.com/wooorm/character-reference-invalid#readme", |
|||
"keywords": [ |
|||
"html", |
|||
"entity", |
|||
"numeric", |
|||
"character", |
|||
"reference", |
|||
"replacement", |
|||
"invalid", |
|||
"name" |
|||
], |
|||
"license": "MIT", |
|||
"main": "index.json", |
|||
"name": "character-reference-invalid", |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"presets": "wooorm" |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/character-reference-invalid.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.json --bare -s characterReferenceInvalid > character-reference-invalid.js", |
|||
"build-generate": "node build", |
|||
"build-mangle": "esmangle character-reference-invalid.js > character-reference-invalid.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.1.0", |
|||
"xo": { |
|||
"space": true, |
|||
"rules": { |
|||
"guard-for-in": "off" |
|||
}, |
|||
"ignores": [ |
|||
"character-reference-invalid.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,51 @@ |
|||
# character-reference-invalid [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
HTML invalid numeric character reference information. |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install character-reference-invalid |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```js |
|||
console.log(characterReferenceInvalid[0x80]); // € |
|||
console.log(characterReferenceInvalid[0x89]); // ‰ |
|||
console.log(characterReferenceInvalid[0x99]); // ™ |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `characterReferenceInvalid` |
|||
|
|||
Mapping between invalid numeric character reference to replacements. |
|||
|
|||
## Support |
|||
|
|||
See [html.spec.whatwg.org][html]. |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/character-reference-invalid.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/character-reference-invalid |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/character-reference-invalid.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/character-reference-invalid |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
|||
|
|||
[html]: https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides |
@ -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. |
@ -0,0 +1,8 @@ |
|||
'use strict'; |
|||
|
|||
module.exports = collapse; |
|||
|
|||
/* collapse(' \t\nbar \nbaz\t'); // ' bar baz ' */ |
|||
function collapse(value) { |
|||
return String(value).replace(/\s+/g, ' '); |
|||
} |
@ -0,0 +1,94 @@ |
|||
{ |
|||
"_from": "collapse-white-space@^1.0.2", |
|||
"_id": "collapse-white-space@1.0.3", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-S5BvZw5aljqHt2sOFolkM0G2Ajw=", |
|||
"_location": "/collapse-white-space", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "collapse-white-space@^1.0.2", |
|||
"name": "collapse-white-space", |
|||
"escapedName": "collapse-white-space", |
|||
"rawSpec": "^1.0.2", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.2" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/remark-parse" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.3.tgz", |
|||
"_shasum": "4b906f670e5a963a87b76b0e1689643341b6023c", |
|||
"_spec": "collapse-white-space@^1.0.2", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/collapse-white-space/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "Replace multiple white-space characters with a single space", |
|||
"devDependencies": { |
|||
"browserify": "^14.0.0", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^11.0.0", |
|||
"remark-cli": "^3.0.0", |
|||
"remark-preset-wooorm": "^3.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.18.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/wooorm/collapse-white-space#readme", |
|||
"keywords": [ |
|||
"collapse", |
|||
"white", |
|||
"space" |
|||
], |
|||
"license": "MIT", |
|||
"name": "collapse-white-space", |
|||
"remarkConfig": { |
|||
"plugins": [ |
|||
"preset-wooorm" |
|||
] |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/collapse-white-space.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.js --bare -s collapseWhiteSpace > collapse-white-space.js", |
|||
"build-mangle": "esmangle collapse-white-space.js > collapse-white-space.min.js", |
|||
"build-md": "remark . -qfo", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.0.3", |
|||
"xo": { |
|||
"space": true, |
|||
"esnext": false, |
|||
"rules": { |
|||
"capitalized-comments": "off" |
|||
}, |
|||
"ignores": [ |
|||
"collapse-white-space.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,45 @@ |
|||
# collapse-white-space [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
Replace multiple white-space characters with a single space. |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install collapse-white-space |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```javascript |
|||
var collapse = require('collapse-white-space'); |
|||
|
|||
collapse('\tfoo \n\tbar \t\r\nbaz'); //=> ' foo bar baz' |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `collapse(value)` |
|||
|
|||
Replace multiple white-space characters in value with a single space. |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/collapse-white-space.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/collapse-white-space |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/collapse-white-space.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/collapse-white-space |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
@ -0,0 +1,21 @@ |
|||
The MIT License (MIT) |
|||
|
|||
Copyright JS Foundation and other contributors, https://js.foundation |
|||
|
|||
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. |
@ -0,0 +1,140 @@ |
|||
# eslint-plugin-markdown |
|||
|
|||
![Screenshot](screenshot.png) |
|||
|
|||
An [ESLint](http://eslint.org/) plugin to lint JavaScript in Markdown. |
|||
|
|||
Supported extensions are `.markdown`, `.mdown`, `.mkdn`, and `.md`. |
|||
|
|||
## Usage |
|||
|
|||
Install the plugin: |
|||
|
|||
```sh |
|||
npm install --save-dev eslint eslint-plugin-markdown |
|||
``` |
|||
|
|||
Add it to your `.eslintrc`: |
|||
|
|||
```json |
|||
{ |
|||
"plugins": [ |
|||
"markdown" |
|||
] |
|||
} |
|||
``` |
|||
|
|||
Run ESLint on `.md` files: |
|||
|
|||
```sh |
|||
eslint --ext md . |
|||
``` |
|||
|
|||
It will lint `js`, `javascript`, `jsx`, or `node` [fenced code blocks](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks) in your Markdown documents: |
|||
|
|||
```js |
|||
// This gets linted |
|||
var answer = 6 * 7; |
|||
console.log(answer); |
|||
``` |
|||
|
|||
```JavaScript |
|||
// This also gets linted |
|||
|
|||
/* eslint quotes: [2, "double"] */ |
|||
|
|||
function hello() { |
|||
console.log("Hello, world!"); |
|||
} |
|||
hello(); |
|||
``` |
|||
|
|||
```jsx |
|||
// This gets linted too |
|||
var div = <div className="jsx"></div>; |
|||
``` |
|||
|
|||
```node |
|||
// And this |
|||
console.log(process.version); |
|||
``` |
|||
|
|||
Blocks that don't specify either `js`, `javascript`, `jsx`, or `node` syntax are ignored: |
|||
|
|||
``` |
|||
This is plain text and doesn't get linted. |
|||
``` |
|||
|
|||
```python |
|||
print("This doesn't get linted either.") |
|||
``` |
|||
|
|||
## Configuration Comments |
|||
|
|||
The processor will convert HTML comments immediately preceding a code block into JavaScript block comments and insert them at the beginning of the source code that it passes to ESLint. This permits configuring ESLint via configuration comments while keeping the configuration comments themselves hidden when the markdown is rendered. Comment bodies are passed through unmodified, so the plugin supports any [configuration comments](http://eslint.org/docs/user-guide/configuring) supported by ESLint itself. |
|||
|
|||
This example enables the `browser` environment, disables the `no-alert` rule, and configures the `quotes` rule to prefer single quotes: |
|||
|
|||
<!-- eslint-env browser --> |
|||
<!-- eslint-disable no-alert --> |
|||
<!-- eslint quotes: ["error", "single"] --> |
|||
|
|||
```js |
|||
alert('Hello, world!'); |
|||
``` |
|||
|
|||
Each code block in a file is linted separately, so configuration comments apply only to the code block that immediately follows. |
|||
|
|||
Assuming `no-alert` is enabled in `.eslintrc`, the first code block will have no error from `no-alert`: |
|||
|
|||
<!-- eslint-env browser --> |
|||
<!-- eslint-disable no-alert --> |
|||
|
|||
```js |
|||
alert("Hello, world!"); |
|||
``` |
|||
|
|||
But the next code block will have an error from `no-alert`: |
|||
|
|||
<!-- eslint-env browser --> |
|||
|
|||
```js |
|||
alert("Hello, world!"); |
|||
``` |
|||
|
|||
## Skipping Blocks |
|||
|
|||
Sometimes it can be useful to have code blocks marked with `js` even though they don't contain valid JavaScript syntax, such as commented JSON blobs that need `js` syntax highlighting. Standard `eslint-disable` comments only silence rule reporting, but ESLint still reports any syntax errors it finds. In cases where a code block should not even be parsed, insert a non-standard `<!-- eslint-skip -->` comment before the block, and this plugin will hide the following block from ESLint. Neither rule nor syntax errors will be reported. |
|||
|
|||
There are comments in this JSON, so we use `js` syntax for better |
|||
highlighting. Skip the block to prevent warnings about invalid syntax. |
|||
|
|||
<!-- eslint-skip --> |
|||
|
|||
```js |
|||
{ |
|||
// This code block is hidden from ESLint. |
|||
"hello": "world" |
|||
} |
|||
``` |
|||
|
|||
```js |
|||
console.log("This code block is linted normally."); |
|||
``` |
|||
|
|||
## Unsatisfiable Rules |
|||
|
|||
Since code blocks are not files themselves but embedded inside a Markdown document, some rules do not apply to Markdown code blocks, and messages from these rules are automatically suppressed: |
|||
|
|||
- `eol-last` |
|||
|
|||
## Contributing |
|||
|
|||
```sh |
|||
$ git clone https://github.com/eslint/eslint-plugin-markdown.git |
|||
$ cd eslint-plugin-markdown |
|||
$ npm install |
|||
$ npm test |
|||
``` |
|||
|
|||
This project follows the [ESLint contribution guidelines](http://eslint.org/docs/developer-guide/contributing/). |
@ -0,0 +1,8 @@ |
|||
/** |
|||
* @fileoverview Exports the processor. |
|||
* @author Brandon Mills |
|||
*/ |
|||
|
|||
"use strict"; |
|||
|
|||
module.exports = require("./lib"); |
@ -0,0 +1,17 @@ |
|||
/** |
|||
* @fileoverview Enables the processor for Markdown file extensions. |
|||
* @author Brandon Mills |
|||
*/ |
|||
|
|||
"use strict"; |
|||
|
|||
var processor = require("./processor"); |
|||
|
|||
module.exports = { |
|||
"processors": { |
|||
".markdown": processor, |
|||
".mdown": processor, |
|||
".mkdn": processor, |
|||
".md": processor |
|||
} |
|||
}; |
@ -0,0 +1,164 @@ |
|||
/** |
|||
* @fileoverview Processes Markdown files for consumption by ESLint. |
|||
* @author Brandon Mills |
|||
*/ |
|||
|
|||
"use strict"; |
|||
|
|||
var assign = require("object-assign"); |
|||
var unified = require("unified"); |
|||
var remarkParse = require("remark-parse"); |
|||
|
|||
var SUPPORTED_SYNTAXES = ["js", "javascript", "node", "jsx"]; |
|||
var UNSATISFIABLE_RULES = [ |
|||
"eol-last" // The Markdown parser strips trailing newlines in code fences
|
|||
]; |
|||
|
|||
var markdown = unified().use(remarkParse); |
|||
|
|||
var blocks = []; |
|||
|
|||
/** |
|||
* Performs a depth-first traversal of the Markdown AST. |
|||
* @param {ASTNode} node A Markdown AST node. |
|||
* @param {object} callbacks A map of node types to callbacks. |
|||
* @param {object} [parent] The node's parent AST node. |
|||
* @returns {void} |
|||
*/ |
|||
function traverse(node, callbacks, parent) { |
|||
var i; |
|||
|
|||
if (callbacks[node.type]) { |
|||
callbacks[node.type](node, parent); |
|||
} |
|||
|
|||
if (typeof node.children !== "undefined") { |
|||
for (i = 0; i < node.children.length; i++) { |
|||
traverse(node.children[i], callbacks, node); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Converts leading HTML comments to JS block comments. |
|||
* @param {string} html The text content of an HTML AST node. |
|||
* @returns {string[]} An array of JS block comments. |
|||
*/ |
|||
function getComment(html) { |
|||
var commentStart = "<!--"; |
|||
var commentEnd = "-->"; |
|||
var prefix = "eslint"; |
|||
|
|||
if ( |
|||
html.slice(0, commentStart.length) !== commentStart || |
|||
html.slice(-commentEnd.length) !== commentEnd |
|||
) { |
|||
return ""; |
|||
} |
|||
|
|||
html = html.slice(commentStart.length, -commentEnd.length); |
|||
|
|||
if (html.trim().slice(0, prefix.length) !== prefix) { |
|||
return ""; |
|||
} |
|||
|
|||
return html; |
|||
} |
|||
|
|||
/** |
|||
* Extracts lintable JavaScript code blocks from Markdown text. |
|||
* @param {string} text The text of the file. |
|||
* @returns {string[]} Source code strings to lint. |
|||
*/ |
|||
function preprocess(text) { |
|||
var ast = markdown.parse(text); |
|||
|
|||
blocks = []; |
|||
traverse(ast, { |
|||
"code": function(node, parent) { |
|||
var comments = []; |
|||
var index, previousNode, comment; |
|||
|
|||
if (node.lang && SUPPORTED_SYNTAXES.indexOf(node.lang.toLowerCase()) >= 0) { |
|||
index = parent.children.indexOf(node) - 1; |
|||
previousNode = parent.children[index]; |
|||
while (previousNode && previousNode.type === "html") { |
|||
comment = getComment(previousNode.value); |
|||
|
|||
if (!comment) { |
|||
break; |
|||
} |
|||
|
|||
if (comment.trim() === "eslint-skip") { |
|||
return; |
|||
} |
|||
|
|||
comments.unshift("/*" + comment + "*/"); |
|||
index--; |
|||
previousNode = parent.children[index]; |
|||
} |
|||
|
|||
blocks.push(assign({}, node, { comments: comments })); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
return blocks.map(function(block) { |
|||
return block.comments.concat(block.value).join("\n"); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Creates a map function that adjusts messages in a code block. |
|||
* @param {Block} block A code block. |
|||
* @returns {function} A function that adjusts messages in a code block. |
|||
*/ |
|||
function adjustBlock(block) { |
|||
var leadingCommentLines = block.comments.reduce(function(count, comment) { |
|||
return count + comment.split("\n").length; |
|||
}, 0); |
|||
|
|||
/** |
|||
* Adjusts ESLint messages to point to the correct location in the Markdown. |
|||
* @param {Message} message A message from ESLint. |
|||
* @returns {Message} The same message, but adjusted ot the correct location. |
|||
*/ |
|||
return function adjustMessage(message) { |
|||
var lineInCode = message.line - leadingCommentLines; |
|||
if (lineInCode < 1) { |
|||
return null; |
|||
} |
|||
|
|||
return assign({}, message, { |
|||
line: lineInCode + block.position.start.line, |
|||
column: message.column + block.position.indent[lineInCode - 1] - 1 |
|||
}); |
|||
}; |
|||
} |
|||
|
|||
/** |
|||
* Excludes unsatisfiable rules from the list of messages. |
|||
* @param {Message} message A message from the linter. |
|||
* @returns {boolean} True if the message should be included in output. |
|||
*/ |
|||
function excludeUnsatisfiableRules(message) { |
|||
return message && UNSATISFIABLE_RULES.indexOf(message.ruleId) < 0; |
|||
} |
|||
|
|||
/** |
|||
* Transforms generated messages for output. |
|||
* @param {Array<Message[]>} messages An array containing one array of messages |
|||
* for each code block returned from `preprocess`. |
|||
* @returns {Message[]} A flattened array of messages with mapped locations. |
|||
*/ |
|||
function postprocess(messages) { |
|||
return [].concat.apply([], messages.map(function(group, i) { |
|||
var adjust = adjustBlock(blocks[i]); |
|||
return group.map(adjust).filter(excludeUnsatisfiableRules); |
|||
})); |
|||
} |
|||
|
|||
module.exports = { |
|||
preprocess: preprocess, |
|||
postprocess: postprocess |
|||
}; |
@ -0,0 +1,80 @@ |
|||
{ |
|||
"_from": "eslint-plugin-markdown@next", |
|||
"_id": "eslint-plugin-markdown@1.0.0-beta.7", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-Euc6QSfEpLedlm+fR1hR3Q949+c=", |
|||
"_location": "/eslint-plugin-markdown", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "tag", |
|||
"registry": true, |
|||
"raw": "eslint-plugin-markdown@next", |
|||
"name": "eslint-plugin-markdown", |
|||
"escapedName": "eslint-plugin-markdown", |
|||
"rawSpec": "next", |
|||
"saveSpec": null, |
|||
"fetchSpec": "next" |
|||
}, |
|||
"_requiredBy": [ |
|||
"#USER", |
|||
"/" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/eslint-plugin-markdown/-/eslint-plugin-markdown-1.0.0-beta.7.tgz", |
|||
"_shasum": "12e73a4127c4a4b79d966f9f475851dd0f78f7e7", |
|||
"_spec": "eslint-plugin-markdown@next", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint", |
|||
"author": { |
|||
"name": "Brandon Mills", |
|||
"url": "https://github.com/btmills" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/eslint/eslint-plugin-markdown/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"dependencies": { |
|||
"object-assign": "^4.0.1", |
|||
"remark-parse": "^3.0.0", |
|||
"unified": "^6.1.2" |
|||
}, |
|||
"deprecated": false, |
|||
"description": "An ESLint plugin to lint JavaScript in Markdown code fences.", |
|||
"devDependencies": { |
|||
"chai": "^3.0.0", |
|||
"eslint": "^2.2.0", |
|||
"eslint-config-eslint": "^3.0.0", |
|||
"eslint-release": "^0.10.2", |
|||
"istanbul": "^0.4.5", |
|||
"mocha": "^2.2.5" |
|||
}, |
|||
"files": [ |
|||
"index.js", |
|||
"lib/index.js", |
|||
"lib/processor.js" |
|||
], |
|||
"homepage": "https://github.com/eslint/eslint-plugin-markdown#readme", |
|||
"keywords": [ |
|||
"eslint", |
|||
"eslintplugin", |
|||
"markdown", |
|||
"lint", |
|||
"linter" |
|||
], |
|||
"license": "MIT", |
|||
"main": "index.js", |
|||
"name": "eslint-plugin-markdown", |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/eslint/eslint-plugin-markdown.git" |
|||
}, |
|||
"scripts": { |
|||
"alpharelease": "eslint-prerelease alpha", |
|||
"betarelease": "eslint-prerelease beta", |
|||
"ci-release": "eslint-ci-release", |
|||
"gh-release": "eslint-gh-release", |
|||
"lint": "eslint Makefile.js lib/**/*.js tests/lib/plugin.js", |
|||
"release": "eslint-release", |
|||
"test": "npm run lint && npm run test-cov", |
|||
"test-cov": "istanbul cover _mocha -- -c tests/lib/**/*.js" |
|||
}, |
|||
"version": "1.0.0-beta.7" |
|||
} |
@ -0,0 +1,22 @@ |
|||
The MIT License (MIT) |
|||
|
|||
Copyright (c) 2014 Stefan Thomas |
|||
|
|||
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. |
@ -0,0 +1,80 @@ |
|||
[![Build Status][travis-svg]][travis-url] |
|||
[![dependency status][deps-svg]][deps-url] |
|||
[![dev dependency status][dev-deps-svg]][dev-deps-url] |
|||
|
|||
# extend() for Node.js <sup>[![Version Badge][npm-version-png]][npm-url]</sup> |
|||
|
|||
`node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true. |
|||
|
|||
Notes: |
|||
|
|||
* Since Node.js >= 4, |
|||
[`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) |
|||
now offers the same functionality natively (but without the "deep copy" option). |
|||
See [ECMAScript 2015 (ES6) in Node.js](https://nodejs.org/en/docs/es6). |
|||
* Some native implementations of `Object.assign` in both Node.js and many |
|||
browsers (since NPM modules are for the browser too) may not be fully |
|||
spec-compliant. |
|||
Check [`object.assign`](https://www.npmjs.com/package/object.assign) module for |
|||
a compliant candidate. |
|||
|
|||
## Installation |
|||
|
|||
This package is available on [npm][npm-url] as: `extend` |
|||
|
|||
``` sh |
|||
npm install extend |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
**Syntax:** extend **(** [`deep`], `target`, `object1`, [`objectN`] **)** |
|||
|
|||
*Extend one object with one or more others, returning the modified object.* |
|||
|
|||
**Example:** |
|||
|
|||
``` js |
|||
var extend = require('extend'); |
|||
extend(targetObject, object1, object2); |
|||
``` |
|||
|
|||
Keep in mind that the target object will be modified, and will be returned from extend(). |
|||
|
|||
If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s). |
|||
Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. |
|||
Warning: passing `false` as the first argument is not supported. |
|||
|
|||
### Arguments |
|||
|
|||
* `deep` *Boolean* (optional) |
|||
If set, the merge becomes recursive (i.e. deep copy). |
|||
* `target` *Object* |
|||
The object to extend. |
|||
* `object1` *Object* |
|||
The object that will be merged into the first. |
|||
* `objectN` *Object* (Optional) |
|||
More objects to merge into the first. |
|||
|
|||
## License |
|||
|
|||
`node-extend` is licensed under the [MIT License][mit-license-url]. |
|||
|
|||
## Acknowledgements |
|||
|
|||
All credit to the jQuery authors for perfecting this amazing utility. |
|||
|
|||
Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jonathan Buchanan][github-insin] and [Jordan Harband][github-ljharb]. |
|||
|
|||
[travis-svg]: https://travis-ci.org/justmoon/node-extend.svg |
|||
[travis-url]: https://travis-ci.org/justmoon/node-extend |
|||
[npm-url]: https://npmjs.org/package/extend |
|||
[mit-license-url]: http://opensource.org/licenses/MIT |
|||
[github-justmoon]: https://github.com/justmoon |
|||
[github-insin]: https://github.com/insin |
|||
[github-ljharb]: https://github.com/ljharb |
|||
[npm-version-png]: http://versionbadg.es/justmoon/node-extend.svg |
|||
[deps-svg]: https://david-dm.org/justmoon/node-extend.svg |
|||
[deps-url]: https://david-dm.org/justmoon/node-extend |
|||
[dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg |
|||
[dev-deps-url]: https://david-dm.org/justmoon/node-extend#info=devDependencies |
@ -0,0 +1,86 @@ |
|||
'use strict'; |
|||
|
|||
var hasOwn = Object.prototype.hasOwnProperty; |
|||
var toStr = Object.prototype.toString; |
|||
|
|||
var isArray = function isArray(arr) { |
|||
if (typeof Array.isArray === 'function') { |
|||
return Array.isArray(arr); |
|||
} |
|||
|
|||
return toStr.call(arr) === '[object Array]'; |
|||
}; |
|||
|
|||
var isPlainObject = function isPlainObject(obj) { |
|||
if (!obj || toStr.call(obj) !== '[object Object]') { |
|||
return false; |
|||
} |
|||
|
|||
var hasOwnConstructor = hasOwn.call(obj, 'constructor'); |
|||
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); |
|||
// Not own constructor property must be Object
|
|||
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { |
|||
return false; |
|||
} |
|||
|
|||
// Own properties are enumerated firstly, so to speed up,
|
|||
// if last one is own, then all properties are own.
|
|||
var key; |
|||
for (key in obj) { /**/ } |
|||
|
|||
return typeof key === 'undefined' || hasOwn.call(obj, key); |
|||
}; |
|||
|
|||
module.exports = function extend() { |
|||
var options, name, src, copy, copyIsArray, clone; |
|||
var target = arguments[0]; |
|||
var i = 1; |
|||
var length = arguments.length; |
|||
var deep = false; |
|||
|
|||
// Handle a deep copy situation
|
|||
if (typeof target === 'boolean') { |
|||
deep = target; |
|||
target = arguments[1] || {}; |
|||
// skip the boolean and the target
|
|||
i = 2; |
|||
} |
|||
if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { |
|||
target = {}; |
|||
} |
|||
|
|||
for (; i < length; ++i) { |
|||
options = arguments[i]; |
|||
// Only deal with non-null/undefined values
|
|||
if (options != null) { |
|||
// Extend the base object
|
|||
for (name in options) { |
|||
src = target[name]; |
|||
copy = options[name]; |
|||
|
|||
// Prevent never-ending loop
|
|||
if (target !== copy) { |
|||
// Recurse if we're merging plain objects or arrays
|
|||
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { |
|||
if (copyIsArray) { |
|||
copyIsArray = false; |
|||
clone = src && isArray(src) ? src : []; |
|||
} else { |
|||
clone = src && isPlainObject(src) ? src : {}; |
|||
} |
|||
|
|||
// Never move original objects, clone them
|
|||
target[name] = extend(deep, clone, copy); |
|||
|
|||
// Don't bring in undefined values
|
|||
} else if (typeof copy !== 'undefined') { |
|||
target[name] = copy; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
// Return the modified object
|
|||
return target; |
|||
}; |
@ -0,0 +1,75 @@ |
|||
{ |
|||
"_from": "extend@^3.0.0", |
|||
"_id": "extend@3.0.1", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", |
|||
"_location": "/extend", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "extend@^3.0.0", |
|||
"name": "extend", |
|||
"escapedName": "extend", |
|||
"rawSpec": "^3.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^3.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/unified" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", |
|||
"_shasum": "a755ea7bc1adfcc5a31ce7e762dbaadc5e636444", |
|||
"_spec": "extend@^3.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unified", |
|||
"author": { |
|||
"name": "Stefan Thomas", |
|||
"email": "justmoon@members.fsf.org", |
|||
"url": "http://www.justmoon.net" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/justmoon/node-extend/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Jordan Harband", |
|||
"url": "https://github.com/ljharb" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "Port of jQuery.extend for node.js and the browser", |
|||
"devDependencies": { |
|||
"@ljharb/eslint-config": "^11.0.0", |
|||
"covert": "^1.1.0", |
|||
"eslint": "^3.19.0", |
|||
"jscs": "^3.0.7", |
|||
"tape": "^4.6.3" |
|||
}, |
|||
"homepage": "https://github.com/justmoon/node-extend#readme", |
|||
"keywords": [ |
|||
"extend", |
|||
"clone", |
|||
"merge" |
|||
], |
|||
"license": "MIT", |
|||
"main": "index", |
|||
"name": "extend", |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/justmoon/node-extend.git" |
|||
}, |
|||
"scripts": { |
|||
"coverage": "covert test/index.js", |
|||
"coverage-quiet": "covert test/index.js --quiet", |
|||
"eslint": "eslint *.js */*.js", |
|||
"jscs": "jscs *.js */*.js", |
|||
"lint": "npm run jscs && npm run eslint", |
|||
"posttest": "npm run coverage-quiet", |
|||
"pretest": "npm run lint", |
|||
"test": "npm run tests-only", |
|||
"tests-only": "node test" |
|||
}, |
|||
"version": "3.0.1" |
|||
} |
@ -0,0 +1,19 @@ |
|||
Copyright (c) 2013 Raynos. |
|||
|
|||
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. |
@ -0,0 +1,48 @@ |
|||
# function-bind |
|||
|
|||
<!-- |
|||
[![build status][travis-svg]][travis-url] |
|||
[![NPM version][npm-badge-svg]][npm-url] |
|||
[![Coverage Status][5]][6] |
|||
[![gemnasium Dependency Status][7]][8] |
|||
[![Dependency status][deps-svg]][deps-url] |
|||
[![Dev Dependency status][dev-deps-svg]][dev-deps-url] |
|||
--> |
|||
|
|||
<!-- [![browser support][11]][12] --> |
|||
|
|||
Implementation of function.prototype.bind |
|||
|
|||
## Example |
|||
|
|||
I mainly do this for unit tests I run on phantomjs. |
|||
PhantomJS does not have Function.prototype.bind :( |
|||
|
|||
```js |
|||
Function.prototype.bind = require("function-bind") |
|||
``` |
|||
|
|||
## Installation |
|||
|
|||
`npm install function-bind` |
|||
|
|||
## Contributors |
|||
|
|||
- Raynos |
|||
|
|||
## MIT Licenced |
|||
|
|||
[travis-svg]: https://travis-ci.org/Raynos/function-bind.svg |
|||
[travis-url]: https://travis-ci.org/Raynos/function-bind |
|||
[npm-badge-svg]: https://badge.fury.io/js/function-bind.svg |
|||
[npm-url]: https://npmjs.org/package/function-bind |
|||
[5]: https://coveralls.io/repos/Raynos/function-bind/badge.png |
|||
[6]: https://coveralls.io/r/Raynos/function-bind |
|||
[7]: https://gemnasium.com/Raynos/function-bind.png |
|||
[8]: https://gemnasium.com/Raynos/function-bind |
|||
[deps-svg]: https://david-dm.org/Raynos/function-bind.svg |
|||
[deps-url]: https://david-dm.org/Raynos/function-bind |
|||
[dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg |
|||
[dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies |
|||
[11]: https://ci.testling.com/Raynos/function-bind.png |
|||
[12]: https://ci.testling.com/Raynos/function-bind |
@ -0,0 +1,48 @@ |
|||
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; |
|||
var slice = Array.prototype.slice; |
|||
var toStr = Object.prototype.toString; |
|||
var funcType = '[object Function]'; |
|||
|
|||
module.exports = function bind(that) { |
|||
var target = this; |
|||
if (typeof target !== 'function' || toStr.call(target) !== funcType) { |
|||
throw new TypeError(ERROR_MESSAGE + target); |
|||
} |
|||
var args = slice.call(arguments, 1); |
|||
|
|||
var bound; |
|||
var binder = function () { |
|||
if (this instanceof bound) { |
|||
var result = target.apply( |
|||
this, |
|||
args.concat(slice.call(arguments)) |
|||
); |
|||
if (Object(result) === result) { |
|||
return result; |
|||
} |
|||
return this; |
|||
} else { |
|||
return target.apply( |
|||
that, |
|||
args.concat(slice.call(arguments)) |
|||
); |
|||
} |
|||
}; |
|||
|
|||
var boundLength = Math.max(0, target.length - args.length); |
|||
var boundArgs = []; |
|||
for (var i = 0; i < boundLength; i++) { |
|||
boundArgs.push('$' + i); |
|||
} |
|||
|
|||
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); |
|||
|
|||
if (target.prototype) { |
|||
var Empty = function Empty() {}; |
|||
Empty.prototype = target.prototype; |
|||
bound.prototype = new Empty(); |
|||
Empty.prototype = null; |
|||
} |
|||
|
|||
return bound; |
|||
}; |
@ -0,0 +1,3 @@ |
|||
var implementation = require('./implementation'); |
|||
|
|||
module.exports = Function.prototype.bind || implementation; |
@ -0,0 +1,98 @@ |
|||
{ |
|||
"_from": "function-bind@^1.0.2", |
|||
"_id": "function-bind@1.1.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-FhdnFMgBeY5Ojyz391KUZ7tKV3E=", |
|||
"_location": "/function-bind", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "function-bind@^1.0.2", |
|||
"name": "function-bind", |
|||
"escapedName": "function-bind", |
|||
"rawSpec": "^1.0.2", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.2" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/has" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz", |
|||
"_shasum": "16176714c801798e4e8f2cf7f7529467bb4a5771", |
|||
"_spec": "function-bind@^1.0.2", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\has", |
|||
"author": { |
|||
"name": "Raynos", |
|||
"email": "raynos2@gmail.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/Raynos/function-bind/issues", |
|||
"email": "raynos2@gmail.com" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Raynos" |
|||
}, |
|||
{ |
|||
"name": "Jordan Harband", |
|||
"url": "https://github.com/ljharb" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "Implementation of Function.prototype.bind", |
|||
"devDependencies": { |
|||
"@ljharb/eslint-config": "^2.1.0", |
|||
"covert": "^1.1.0", |
|||
"eslint": "^2.0.0", |
|||
"jscs": "^2.9.0", |
|||
"tape": "^4.4.0" |
|||
}, |
|||
"homepage": "https://github.com/Raynos/function-bind", |
|||
"keywords": [ |
|||
"function", |
|||
"bind", |
|||
"shim", |
|||
"es5" |
|||
], |
|||
"licenses": [ |
|||
{ |
|||
"type": "MIT", |
|||
"url": "http://github.com/Raynos/function-bind/raw/master/LICENSE" |
|||
} |
|||
], |
|||
"main": "index", |
|||
"name": "function-bind", |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git://github.com/Raynos/function-bind.git" |
|||
}, |
|||
"scripts": { |
|||
"coverage": "covert test/*.js", |
|||
"coverage-quiet": "covert test/*.js --quiet", |
|||
"eslint": "eslint *.js */*.js", |
|||
"jscs": "jscs *.js */*.js", |
|||
"lint": "npm run jscs && npm run eslint", |
|||
"test": "npm run lint && npm run tests-only && npm run coverage-quiet", |
|||
"tests-only": "node test" |
|||
}, |
|||
"testling": { |
|||
"files": "test/index.js", |
|||
"browsers": [ |
|||
"ie/8..latest", |
|||
"firefox/16..latest", |
|||
"firefox/nightly", |
|||
"chrome/22..latest", |
|||
"chrome/canary", |
|||
"opera/12..latest", |
|||
"opera/next", |
|||
"safari/5.1..latest", |
|||
"ipad/6.0..latest", |
|||
"iphone/6.0..latest", |
|||
"android-browser/4.2..latest" |
|||
] |
|||
}, |
|||
"version": "1.1.0" |
|||
} |
@ -0,0 +1,22 @@ |
|||
Copyright (c) 2013 Thiago de Arruda |
|||
|
|||
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. |
@ -0,0 +1,18 @@ |
|||
# has |
|||
|
|||
> Object.prototype.hasOwnProperty.call shortcut |
|||
|
|||
## Installation |
|||
|
|||
```sh |
|||
npm install --save has |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```js |
|||
var has = require('has'); |
|||
|
|||
has({}, 'hasOwnProperty'); // false |
|||
has(Object.prototype, 'hasOwnProperty'); // true |
|||
``` |
@ -0,0 +1,62 @@ |
|||
{ |
|||
"_from": "has@^1.0.1", |
|||
"_id": "has@1.0.1", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", |
|||
"_location": "/has", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "has@^1.0.1", |
|||
"name": "has", |
|||
"escapedName": "has", |
|||
"rawSpec": "^1.0.1", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.1" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/remark-parse" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", |
|||
"_shasum": "8461733f538b0837c9361e39a9ab9e9704dc2f28", |
|||
"_spec": "has@^1.0.1", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", |
|||
"author": { |
|||
"name": "Thiago de Arruda", |
|||
"email": "tpadilha84@gmail.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/tarruda/has/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"dependencies": { |
|||
"function-bind": "^1.0.2" |
|||
}, |
|||
"deprecated": false, |
|||
"description": "Object.prototype.hasOwnProperty.call shortcut", |
|||
"devDependencies": { |
|||
"chai": "~1.7.2", |
|||
"mocha": "^1.21.4" |
|||
}, |
|||
"engines": { |
|||
"node": ">= 0.8.0" |
|||
}, |
|||
"homepage": "https://github.com/tarruda/has", |
|||
"licenses": [ |
|||
{ |
|||
"type": "MIT", |
|||
"url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" |
|||
} |
|||
], |
|||
"main": "./src/index", |
|||
"name": "has", |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git://github.com/tarruda/has.git" |
|||
}, |
|||
"scripts": { |
|||
"test": "node_modules/mocha/bin/mocha" |
|||
}, |
|||
"version": "1.0.1" |
|||
} |
@ -0,0 +1,3 @@ |
|||
var bind = require('function-bind'); |
|||
|
|||
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); |
@ -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. |
@ -0,0 +1,6 @@ |
|||
<!--remark setext--> |
|||
|
|||
<!--lint disable no-multiple-toplevel-headings --> |
|||
|
|||
1.0.0 / 2016-07-11 |
|||
================== |
@ -0,0 +1,29 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2016 Titus Wormer |
|||
* @license MIT |
|||
* @module is-alphabetical |
|||
* @fileoverview Check if a character is alphabetical. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
/* eslint-env commonjs */ |
|||
|
|||
/* Expose. */ |
|||
module.exports = alphabetical; |
|||
|
|||
/** |
|||
* Check whether the given character code, or the character |
|||
* code at the first character, is alphabetical. |
|||
* |
|||
* @param {string|number} character |
|||
* @return {boolean} - Whether `character` is alphabetical. |
|||
*/ |
|||
function alphabetical(character) { |
|||
var code = typeof character === 'string' ? |
|||
character.charCodeAt(0) : character; |
|||
|
|||
return (code >= 97 && code <= 122) || /* a-z */ |
|||
(code >= 65 && code <= 90); /* A-Z */ |
|||
} |
@ -0,0 +1,110 @@ |
|||
{ |
|||
"_from": "is-alphabetical@^1.0.0", |
|||
"_id": "is-alphabetical@1.0.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-4lRMEwWCVfIUTLdXBmzTNCocjEY=", |
|||
"_location": "/is-alphabetical", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "is-alphabetical@^1.0.0", |
|||
"name": "is-alphabetical", |
|||
"escapedName": "is-alphabetical", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/is-alphanumerical", |
|||
"/remark-parse" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.0.tgz", |
|||
"_shasum": "e2544c13058255f2144cb757066cd3342a1c8c46", |
|||
"_spec": "is-alphabetical@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/is-alphabetical/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "Check if a character is alphabetical", |
|||
"devDependencies": { |
|||
"browserify": "^13.0.1", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^7.0.0", |
|||
"remark-cli": "^1.0.0", |
|||
"remark-comment-config": "^4.0.0", |
|||
"remark-github": "^5.0.0", |
|||
"remark-lint": "^4.0.0", |
|||
"remark-validate-links": "^4.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.16.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/wooorm/is-alphabetical#readme", |
|||
"keywords": [ |
|||
"string", |
|||
"character", |
|||
"char", |
|||
"code", |
|||
"alphabetical" |
|||
], |
|||
"license": "MIT", |
|||
"name": "is-alphabetical", |
|||
"nyc": { |
|||
"check-coverage": true, |
|||
"lines": 100, |
|||
"functions": 100, |
|||
"branches": 100 |
|||
}, |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"plugins": [ |
|||
"comment-config", |
|||
"github", |
|||
"lint", |
|||
"validate-links" |
|||
], |
|||
"settings": { |
|||
"bullet": "*" |
|||
} |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/is-alphabetical.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.js --bare -s isAlphabetical > is-alphabetical.js", |
|||
"build-mangle": "esmangle < is-alphabetical.js > is-alphabetical.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.0.0", |
|||
"xo": { |
|||
"space": true, |
|||
"ignores": [ |
|||
"is-alphabetical.js", |
|||
"is-alphabetical.min.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,58 @@ |
|||
# is-alphabetical [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
<!--lint disable heading-increment list-item-spacing--> |
|||
|
|||
Check if a character is alphabetical. |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install is-alphabetical |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
Dependencies: |
|||
|
|||
```javascript |
|||
var alphabetical = require('is-alphabetical'); |
|||
|
|||
alphabetical('a'); // true |
|||
alphabetical('B'); // true |
|||
alphabetical('0'); // false |
|||
alphabetical('💩'); // false |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `alphabetical(character)` |
|||
|
|||
Check whether the given character code (`number`), or the character |
|||
code at the first position (`string`), is alphabetical. |
|||
|
|||
## Related |
|||
|
|||
* [`is-decimal`](https://github.com/wooorm/is-decimal) |
|||
* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/is-alphabetical.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/is-alphabetical |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-alphabetical.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/is-alphabetical |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
@ -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. |
@ -0,0 +1,6 @@ |
|||
<!--remark setext--> |
|||
|
|||
<!--lint disable no-multiple-toplevel-headings --> |
|||
|
|||
1.0.0 / 2016-07-12 |
|||
================== |
@ -0,0 +1,29 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2016 Titus Wormer |
|||
* @license MIT |
|||
* @module is-alphanumerical |
|||
* @fileoverview Check if a character is alphanumerical. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
/* eslint-env commonjs */ |
|||
|
|||
/* Dependencies. */ |
|||
var alphabetical = require('is-alphabetical'); |
|||
var decimal = require('is-decimal'); |
|||
|
|||
/* Expose. */ |
|||
module.exports = alphanumerical; |
|||
|
|||
/** |
|||
* Check whether the given character code, or the character |
|||
* code at the first character, is alphanumerical. |
|||
* |
|||
* @param {string|number} character |
|||
* @return {boolean} - Whether `character` is alphanumerical. |
|||
*/ |
|||
function alphanumerical(character) { |
|||
return alphabetical(character) || decimal(character); |
|||
} |
@ -0,0 +1,114 @@ |
|||
{ |
|||
"_from": "is-alphanumerical@^1.0.0", |
|||
"_id": "is-alphanumerical@1.0.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-4GSS5xnBvxXewjnk8a9fZ7TW578=", |
|||
"_location": "/is-alphanumerical", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "is-alphanumerical@^1.0.0", |
|||
"name": "is-alphanumerical", |
|||
"escapedName": "is-alphanumerical", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/parse-entities" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.0.tgz", |
|||
"_shasum": "e06492e719c1bf15dec239e4f1af5f67b4d6e7bf", |
|||
"_spec": "is-alphanumerical@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\parse-entities", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/is-alphanumerical/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": { |
|||
"is-alphabetical": "^1.0.0", |
|||
"is-decimal": "^1.0.0" |
|||
}, |
|||
"deprecated": false, |
|||
"description": "Check if a character is alphanumerical", |
|||
"devDependencies": { |
|||
"browserify": "^13.0.1", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^7.0.0", |
|||
"remark-cli": "^1.0.0", |
|||
"remark-comment-config": "^4.0.0", |
|||
"remark-github": "^5.0.0", |
|||
"remark-lint": "^4.0.0", |
|||
"remark-validate-links": "^4.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.16.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/wooorm/is-alphanumerical#readme", |
|||
"keywords": [ |
|||
"string", |
|||
"character", |
|||
"char", |
|||
"code", |
|||
"alphabetical", |
|||
"numerical", |
|||
"alphanumerical" |
|||
], |
|||
"license": "MIT", |
|||
"name": "is-alphanumerical", |
|||
"nyc": { |
|||
"check-coverage": true, |
|||
"lines": 100, |
|||
"functions": 100, |
|||
"branches": 100 |
|||
}, |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"plugins": [ |
|||
"comment-config", |
|||
"github", |
|||
"lint", |
|||
"validate-links" |
|||
], |
|||
"settings": { |
|||
"bullet": "*" |
|||
} |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/is-alphanumerical.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.js --bare -s isAlphanumerical > is-alphanumerical.js", |
|||
"build-mangle": "esmangle < is-alphanumerical.js > is-alphanumerical.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.0.0", |
|||
"xo": { |
|||
"space": true, |
|||
"ignores": [ |
|||
"is-alphanumerical.js", |
|||
"is-alphanumerical.min.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,60 @@ |
|||
# is-alphanumerical [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
<!--lint disable heading-increment list-item-spacing--> |
|||
|
|||
Check if a character is alphanumerical (`[a-zA-Z0-9]`). |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install is-alphanumerical |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```javascript |
|||
var alphanumerical = require('is-alphanumerical'); |
|||
|
|||
alphanumerical('a'); // true |
|||
alphanumerical('Z'); // true |
|||
alphanumerical('0'); // true |
|||
alphanumerical(' '); // false |
|||
alphanumerical('💩'); // false |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `alphanumerical(character)` |
|||
|
|||
Check whether the given character code (`number`), or the character |
|||
code at the first position (`string`), is alphanumerical. |
|||
|
|||
## Related |
|||
|
|||
* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) |
|||
* [`is-decimal`](https://github.com/wooorm/is-decimal) |
|||
* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) |
|||
* [`is-whitespace-character`](https://github.com/wooorm/is-whitespace-character) |
|||
* [`is-word-character`](https://github.com/wooorm/is-word-character) |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/is-alphanumerical.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/is-alphanumerical |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-alphanumerical.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/is-alphanumerical |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
@ -0,0 +1,21 @@ |
|||
The MIT License (MIT) |
|||
|
|||
Copyright (c) Feross Aboukhadijeh |
|||
|
|||
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. |
@ -0,0 +1,49 @@ |
|||
# is-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][npm-url] |
|||
|
|||
#### Determine if an object is a [`Buffer`](http://nodejs.org/api/buffer.html) (including the [browserify Buffer](https://github.com/feross/buffer)) |
|||
|
|||
[![saucelabs][saucelabs-image]][saucelabs-url] |
|||
|
|||
[travis-image]: https://img.shields.io/travis/feross/is-buffer/master.svg |
|||
[travis-url]: https://travis-ci.org/feross/is-buffer |
|||
[npm-image]: https://img.shields.io/npm/v/is-buffer.svg |
|||
[npm-url]: https://npmjs.org/package/is-buffer |
|||
[downloads-image]: https://img.shields.io/npm/dm/is-buffer.svg |
|||
[saucelabs-image]: https://saucelabs.com/browser-matrix/is-buffer.svg |
|||
[saucelabs-url]: https://saucelabs.com/u/is-buffer |
|||
|
|||
## Why not use `Buffer.isBuffer`? |
|||
|
|||
This module lets you check if an object is a `Buffer` without using `Buffer.isBuffer` (which includes the whole [buffer](https://github.com/feross/buffer) module in [browserify](http://browserify.org/)). |
|||
|
|||
It's future-proof and works in node too! |
|||
|
|||
## install |
|||
|
|||
```bash |
|||
npm install is-buffer |
|||
``` |
|||
|
|||
## usage |
|||
|
|||
```js |
|||
var isBuffer = require('is-buffer') |
|||
|
|||
isBuffer(new Buffer(4)) // true |
|||
|
|||
isBuffer(undefined) // false |
|||
isBuffer(null) // false |
|||
isBuffer('') // false |
|||
isBuffer(true) // false |
|||
isBuffer(false) // false |
|||
isBuffer(0) // false |
|||
isBuffer(1) // false |
|||
isBuffer(1.0) // false |
|||
isBuffer('string') // false |
|||
isBuffer({}) // false |
|||
isBuffer(function foo () {}) // false |
|||
``` |
|||
|
|||
## license |
|||
|
|||
MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org). |
@ -0,0 +1,21 @@ |
|||
/*! |
|||
* Determine if an object is a Buffer |
|||
* |
|||
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|||
* @license MIT |
|||
*/ |
|||
|
|||
// The _isBuffer check is for Safari 5-7 support, because it's missing
|
|||
// Object.prototype.constructor. Remove this eventually
|
|||
module.exports = function (obj) { |
|||
return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) |
|||
} |
|||
|
|||
function isBuffer (obj) { |
|||
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) |
|||
} |
|||
|
|||
// For Node v0.10 support. Remove this eventually.
|
|||
function isSlowBuffer (obj) { |
|||
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) |
|||
} |
@ -0,0 +1,77 @@ |
|||
{ |
|||
"_from": "is-buffer@^1.1.4", |
|||
"_id": "is-buffer@1.1.5", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", |
|||
"_location": "/is-buffer", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "is-buffer@^1.1.4", |
|||
"name": "is-buffer", |
|||
"escapedName": "is-buffer", |
|||
"rawSpec": "^1.1.4", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.1.4" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/vfile" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", |
|||
"_shasum": "1f3b26ef613b214b88cbca23cc6c01d87961eecc", |
|||
"_spec": "is-buffer@^1.1.4", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\vfile", |
|||
"author": { |
|||
"name": "Feross Aboukhadijeh", |
|||
"email": "feross@feross.org", |
|||
"url": "http://feross.org/" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/feross/is-buffer/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "Determine if an object is a Buffer", |
|||
"devDependencies": { |
|||
"standard": "*", |
|||
"tape": "^4.0.0", |
|||
"zuul": "^3.0.0" |
|||
}, |
|||
"homepage": "https://github.com/feross/is-buffer#readme", |
|||
"keywords": [ |
|||
"buffer", |
|||
"buffers", |
|||
"type", |
|||
"core buffer", |
|||
"browser buffer", |
|||
"browserify", |
|||
"typed array", |
|||
"uint32array", |
|||
"int16array", |
|||
"int32array", |
|||
"float32array", |
|||
"float64array", |
|||
"browser", |
|||
"arraybuffer", |
|||
"dataview" |
|||
], |
|||
"license": "MIT", |
|||
"main": "index.js", |
|||
"name": "is-buffer", |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git://github.com/feross/is-buffer.git" |
|||
}, |
|||
"scripts": { |
|||
"test": "standard && npm run test-node && npm run test-browser", |
|||
"test-browser": "zuul -- test/*.js", |
|||
"test-browser-local": "zuul --local -- test/*.js", |
|||
"test-node": "tape test/*.js" |
|||
}, |
|||
"testling": { |
|||
"files": "test/*.js" |
|||
}, |
|||
"version": "1.1.5" |
|||
} |
@ -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. |
@ -0,0 +1,6 @@ |
|||
<!--remark setext--> |
|||
|
|||
<!--lint disable no-multiple-toplevel-headings --> |
|||
|
|||
1.0.0 / 2016-07-11 |
|||
================== |
@ -0,0 +1,28 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2016 Titus Wormer |
|||
* @license MIT |
|||
* @module is-decimal |
|||
* @fileoverview Check if a character is decimal. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
/* eslint-env commonjs */ |
|||
|
|||
/* Expose. */ |
|||
module.exports = decimal; |
|||
|
|||
/** |
|||
* Check whether the given character code, or the character |
|||
* code at the first character, is decimal. |
|||
* |
|||
* @param {string|number} character |
|||
* @return {boolean} - Whether `character` is decimal. |
|||
*/ |
|||
function decimal(character) { |
|||
var code = typeof character === 'string' ? |
|||
character.charCodeAt(0) : character; |
|||
|
|||
return code >= 48 && code <= 57; /* 0-9 */ |
|||
} |
@ -0,0 +1,111 @@ |
|||
{ |
|||
"_from": "is-decimal@^1.0.0", |
|||
"_id": "is-decimal@1.0.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-lAV5tupjxigICmnmK9qIyEcLT+A=", |
|||
"_location": "/is-decimal", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "is-decimal@^1.0.0", |
|||
"name": "is-decimal", |
|||
"escapedName": "is-decimal", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/is-alphanumerical", |
|||
"/parse-entities", |
|||
"/remark-parse" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.0.tgz", |
|||
"_shasum": "940579b6ea63c628080a69e62bda88c8470b4fe0", |
|||
"_spec": "is-decimal@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/is-decimal/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "Check if a character is decimal", |
|||
"devDependencies": { |
|||
"browserify": "^13.0.1", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^7.0.0", |
|||
"remark-cli": "^1.0.0", |
|||
"remark-comment-config": "^4.0.0", |
|||
"remark-github": "^5.0.0", |
|||
"remark-lint": "^4.0.0", |
|||
"remark-validate-links": "^4.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.16.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/wooorm/is-decimal#readme", |
|||
"keywords": [ |
|||
"string", |
|||
"character", |
|||
"char", |
|||
"code", |
|||
"decimal" |
|||
], |
|||
"license": "MIT", |
|||
"name": "is-decimal", |
|||
"nyc": { |
|||
"check-coverage": true, |
|||
"lines": 100, |
|||
"functions": 100, |
|||
"branches": 100 |
|||
}, |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"plugins": [ |
|||
"comment-config", |
|||
"github", |
|||
"lint", |
|||
"validate-links" |
|||
], |
|||
"settings": { |
|||
"bullet": "*" |
|||
} |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/is-decimal.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.js --bare -s isDecimal > is-decimal.js", |
|||
"build-mangle": "esmangle < is-decimal.js > is-decimal.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.0.0", |
|||
"xo": { |
|||
"space": true, |
|||
"ignores": [ |
|||
"is-decimal.js", |
|||
"is-decimal.min.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,58 @@ |
|||
# is-decimal [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
<!--lint disable heading-increment list-item-spacing--> |
|||
|
|||
Check if a character is decimal. |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install is-decimal |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
Dependencies: |
|||
|
|||
```javascript |
|||
var decimal = require('is-decimal'); |
|||
|
|||
decimal('0'); // true |
|||
decimal('9'); // true |
|||
decimal('a'); // false |
|||
decimal('💩'); // false |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `decimal(character)` |
|||
|
|||
Check whether the given character code (`number`), or the character |
|||
code at the first position (`string`), is decimal. |
|||
|
|||
## Related |
|||
|
|||
* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) |
|||
* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/is-decimal.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/is-decimal |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-decimal.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/is-decimal |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
@ -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. |
@ -0,0 +1,6 @@ |
|||
<!--remark setext--> |
|||
|
|||
<!--lint disable no-multiple-toplevel-headings --> |
|||
|
|||
1.0.0 / 2016-07-11 |
|||
================== |
@ -0,0 +1,30 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2016 Titus Wormer |
|||
* @license MIT |
|||
* @module is-hexadecimal |
|||
* @fileoverview Check if a character is hexadecimal. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
/* eslint-env commonjs */ |
|||
|
|||
/* Expose. */ |
|||
module.exports = hexadecimal; |
|||
|
|||
/** |
|||
* Check whether the given character code, or the character |
|||
* code at the first character, is hexadecimal. |
|||
* |
|||
* @param {string|number} character |
|||
* @return {boolean} - Whether `character` is hexadecimal. |
|||
*/ |
|||
function hexadecimal(character) { |
|||
var code = typeof character === 'string' ? |
|||
character.charCodeAt(0) : character; |
|||
|
|||
return (code >= 97 /* a */ && code <= 102 /* z */) || |
|||
(code >= 65 /* A */ && code <= 70 /* Z */) || |
|||
(code >= 48 /* A */ && code <= 57 /* Z */); |
|||
} |
@ -0,0 +1,109 @@ |
|||
{ |
|||
"_from": "is-hexadecimal@^1.0.0", |
|||
"_id": "is-hexadecimal@1.0.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-XEWXcdKvmi45Ungf1U/LG8/kETw=", |
|||
"_location": "/is-hexadecimal", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "is-hexadecimal@^1.0.0", |
|||
"name": "is-hexadecimal", |
|||
"escapedName": "is-hexadecimal", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/parse-entities" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.0.tgz", |
|||
"_shasum": "5c459771d2af9a2e3952781fd54fcb1bcfe4113c", |
|||
"_spec": "is-hexadecimal@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\parse-entities", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/is-hexadecimal/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "Check if a character is hexadecimal", |
|||
"devDependencies": { |
|||
"browserify": "^13.0.1", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^7.0.0", |
|||
"remark-cli": "^1.0.0", |
|||
"remark-comment-config": "^4.0.0", |
|||
"remark-github": "^5.0.0", |
|||
"remark-lint": "^4.0.0", |
|||
"remark-validate-links": "^4.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.16.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/wooorm/is-hexadecimal#readme", |
|||
"keywords": [ |
|||
"string", |
|||
"character", |
|||
"char", |
|||
"code", |
|||
"hexadecimal" |
|||
], |
|||
"license": "MIT", |
|||
"name": "is-hexadecimal", |
|||
"nyc": { |
|||
"check-coverage": true, |
|||
"lines": 100, |
|||
"functions": 100, |
|||
"branches": 100 |
|||
}, |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"plugins": [ |
|||
"comment-config", |
|||
"github", |
|||
"lint", |
|||
"validate-links" |
|||
], |
|||
"settings": { |
|||
"bullet": "*" |
|||
} |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/is-hexadecimal.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.js --bare -s isHexadecimal > is-hexadecimal.js", |
|||
"build-mangle": "esmangle < is-hexadecimal.js > is-hexadecimal.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.0.0", |
|||
"xo": { |
|||
"space": true, |
|||
"ignores": [ |
|||
"is-hexadecimal.js", |
|||
"is-hexadecimal.min.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,58 @@ |
|||
# is-hexadecimal [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
<!--lint disable heading-increment list-item-spacing--> |
|||
|
|||
Check if a character is hexadecimal. |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install is-hexadecimal |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
Dependencies: |
|||
|
|||
```javascript |
|||
var hexadecimal = require('is-hexadecimal'); |
|||
|
|||
hexadecimal('a'); // true |
|||
hexadecimal('0'); // true |
|||
hexadecimal('G'); // false |
|||
hexadecimal('💩'); // false |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `hexadecimal(character)` |
|||
|
|||
Check whether the given character code (`number`), or the character |
|||
code at the first position (`string`), is hexadecimal. |
|||
|
|||
## Related |
|||
|
|||
* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) |
|||
* [`is-decimal`](https://github.com/wooorm/is-decimal) |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/is-hexadecimal.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/is-hexadecimal |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-hexadecimal.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/is-hexadecimal |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
@ -0,0 +1,7 @@ |
|||
'use strict'; |
|||
var toString = Object.prototype.toString; |
|||
|
|||
module.exports = function (x) { |
|||
var prototype; |
|||
return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); |
|||
}; |
@ -0,0 +1,21 @@ |
|||
The MIT License (MIT) |
|||
|
|||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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. |
@ -0,0 +1,68 @@ |
|||
{ |
|||
"_from": "is-plain-obj@^1.1.0", |
|||
"_id": "is-plain-obj@1.1.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", |
|||
"_location": "/is-plain-obj", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "is-plain-obj@^1.1.0", |
|||
"name": "is-plain-obj", |
|||
"escapedName": "is-plain-obj", |
|||
"rawSpec": "^1.1.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.1.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/unified" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", |
|||
"_shasum": "71a50c8429dfca773c92a390a4a03b39fcd51d3e", |
|||
"_spec": "is-plain-obj@^1.1.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\unified", |
|||
"author": { |
|||
"name": "Sindre Sorhus", |
|||
"email": "sindresorhus@gmail.com", |
|||
"url": "sindresorhus.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/sindresorhus/is-plain-obj/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"deprecated": false, |
|||
"description": "Check if a value is a plain object", |
|||
"devDependencies": { |
|||
"ava": "0.0.4" |
|||
}, |
|||
"engines": { |
|||
"node": ">=0.10.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/sindresorhus/is-plain-obj#readme", |
|||
"keywords": [ |
|||
"obj", |
|||
"object", |
|||
"is", |
|||
"check", |
|||
"test", |
|||
"type", |
|||
"plain", |
|||
"vanilla", |
|||
"pure", |
|||
"simple" |
|||
], |
|||
"license": "MIT", |
|||
"name": "is-plain-obj", |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/sindresorhus/is-plain-obj.git" |
|||
}, |
|||
"scripts": { |
|||
"test": "node test.js" |
|||
}, |
|||
"version": "1.1.0" |
|||
} |
@ -0,0 +1,35 @@ |
|||
# is-plain-obj [![Build Status](https://travis-ci.org/sindresorhus/is-plain-obj.svg?branch=master)](https://travis-ci.org/sindresorhus/is-plain-obj) |
|||
|
|||
> Check if a value is a plain object |
|||
|
|||
An object is plain if it's created by either `{}`, `new Object()` or `Object.create(null)`. |
|||
|
|||
|
|||
## Install |
|||
|
|||
``` |
|||
$ npm install --save is-plain-obj |
|||
``` |
|||
|
|||
|
|||
## Usage |
|||
|
|||
```js |
|||
var isPlainObj = require('is-plain-obj'); |
|||
|
|||
isPlainObj({foo: 'bar'}); |
|||
//=> true |
|||
|
|||
isPlainObj([1, 2, 3]); |
|||
//=> false |
|||
``` |
|||
|
|||
|
|||
## Related |
|||
|
|||
- [is-obj](https://github.com/sindresorhus/is-obj) - Check if a value is an object |
|||
|
|||
|
|||
## License |
|||
|
|||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
@ -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. |
@ -0,0 +1,6 @@ |
|||
<!--remark setext--> |
|||
|
|||
<!--lint disable no-multiple-toplevel-headings --> |
|||
|
|||
1.0.0 / 2016-07-12 |
|||
================== |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2016 Titus Wormer |
|||
* @license MIT |
|||
* @module is-whitespace-character |
|||
* @fileoverview Check if a character is a whitespace character. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
/* eslint-env commonjs */ |
|||
|
|||
/* Expose. */ |
|||
module.exports = whitespace; |
|||
|
|||
/* Methods. */ |
|||
var fromCode = String.fromCharCode; |
|||
|
|||
/* Constants. */ |
|||
var re = /\s/; |
|||
|
|||
/** |
|||
* Check whether the given character code, or the character |
|||
* code at the first character, is a whitespace character. |
|||
* |
|||
* @param {string|number} character |
|||
* @return {boolean} - Whether `character` is a whitespaces character. |
|||
*/ |
|||
function whitespace(character) { |
|||
return re.test( |
|||
typeof character === 'number' ? fromCode(character) : character.charAt(0) |
|||
); |
|||
} |
@ -0,0 +1,111 @@ |
|||
{ |
|||
"_from": "is-whitespace-character@^1.0.0", |
|||
"_id": "is-whitespace-character@1.0.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-u/SoN2Tq0NRRvsKlUhjpGWGtwnU=", |
|||
"_location": "/is-whitespace-character", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "is-whitespace-character@^1.0.0", |
|||
"name": "is-whitespace-character", |
|||
"escapedName": "is-whitespace-character", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/remark-parse" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.0.tgz", |
|||
"_shasum": "bbf4a83764ead0d451bec2a55218e91961adc275", |
|||
"_spec": "is-whitespace-character@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/is-whitespace-character/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "Check if a character is a whitespace character", |
|||
"devDependencies": { |
|||
"browserify": "^13.0.1", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^7.0.0", |
|||
"remark-cli": "^1.0.0", |
|||
"remark-comment-config": "^4.0.0", |
|||
"remark-github": "^5.0.0", |
|||
"remark-lint": "^4.0.0", |
|||
"remark-validate-links": "^4.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.16.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/wooorm/is-whitespace-character#readme", |
|||
"keywords": [ |
|||
"string", |
|||
"character", |
|||
"char", |
|||
"code", |
|||
"whitespace", |
|||
"white", |
|||
"space" |
|||
], |
|||
"license": "MIT", |
|||
"name": "is-whitespace-character", |
|||
"nyc": { |
|||
"check-coverage": true, |
|||
"lines": 100, |
|||
"functions": 100, |
|||
"branches": 100 |
|||
}, |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"plugins": [ |
|||
"comment-config", |
|||
"github", |
|||
"lint", |
|||
"validate-links" |
|||
], |
|||
"settings": { |
|||
"bullet": "*" |
|||
} |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/is-whitespace-character.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.js --bare -s isWhitespaceCharacter > is-whitespace-character.js", |
|||
"build-mangle": "esmangle < is-whitespace-character.js > is-whitespace-character.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.0.0", |
|||
"xo": { |
|||
"space": true, |
|||
"ignores": [ |
|||
"is-whitespace-character.js", |
|||
"is-whitespace-character.min.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,63 @@ |
|||
# is-whitespace-character [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
<!--lint disable heading-increment list-item-spacing--> |
|||
|
|||
Check if a character is a whitespace character: `\s`, which equals |
|||
all Unicode Space Separators (including `[ \t\v\f]`), the BOM |
|||
(`\uFEFF`), and line terminator (`[\n\r\u2028\u2029]`). |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install is-whitespace-character |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```javascript |
|||
var whitespace = require('is-whitespace-character'); |
|||
|
|||
whitespace(' '); // true |
|||
whitespace('\n'); // true |
|||
whitespace('\ufeff'); // true |
|||
whitespace('_'); // false |
|||
whitespace('a'); // true |
|||
whitespace('💩'); // false |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `whitespaceCharacter(character)` |
|||
|
|||
Check whether the given character code (`number`), or the character |
|||
code at the first position (`string`), is a whitespace character. |
|||
|
|||
## Related |
|||
|
|||
* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) |
|||
* [`is-alphanumerical`](https://github.com/wooorm/is-alphanumerical) |
|||
* [`is-decimal`](https://github.com/wooorm/is-decimal) |
|||
* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) |
|||
* [`is-word-character`](https://github.com/wooorm/is-word-character) |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/is-whitespace-character.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/is-whitespace-character |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-whitespace-character.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/is-whitespace-character |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
@ -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. |
@ -0,0 +1,6 @@ |
|||
<!--remark setext--> |
|||
|
|||
<!--lint disable no-multiple-toplevel-headings --> |
|||
|
|||
1.0.0 / 2016-07-12 |
|||
================== |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2016 Titus Wormer |
|||
* @license MIT |
|||
* @module is-word-character |
|||
* @fileoverview Check if a character is a word character. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
/* eslint-env commonjs */ |
|||
|
|||
/* Expose. */ |
|||
module.exports = wordCharacter; |
|||
|
|||
/* Methods. */ |
|||
var fromCode = String.fromCharCode; |
|||
|
|||
/* Constants. */ |
|||
var re = /\w/; |
|||
|
|||
/** |
|||
* Check whether the given character code, or the character |
|||
* code at the first character, is a word character. |
|||
* |
|||
* @param {string|number} character |
|||
* @return {boolean} - Whether `character` is a word character. |
|||
*/ |
|||
function wordCharacter(character) { |
|||
return re.test( |
|||
typeof character === 'number' ? fromCode(character) : character.charAt(0) |
|||
); |
|||
} |
@ -0,0 +1,109 @@ |
|||
{ |
|||
"_from": "is-word-character@^1.0.0", |
|||
"_id": "is-word-character@1.0.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-o6nl3a1wxcLuNvSpz8mlP0RTUkc=", |
|||
"_location": "/is-word-character", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "is-word-character@^1.0.0", |
|||
"name": "is-word-character", |
|||
"escapedName": "is-word-character", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/remark-parse" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.0.tgz", |
|||
"_shasum": "a3a9e5ddad70c5c2ee36f4a9cfc9a53f44535247", |
|||
"_spec": "is-word-character@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/is-word-character/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "Check if a character is a word character", |
|||
"devDependencies": { |
|||
"browserify": "^13.0.1", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^7.0.0", |
|||
"remark-cli": "^1.0.0", |
|||
"remark-comment-config": "^4.0.0", |
|||
"remark-github": "^5.0.0", |
|||
"remark-lint": "^4.0.0", |
|||
"remark-validate-links": "^4.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.16.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/wooorm/is-word-character#readme", |
|||
"keywords": [ |
|||
"string", |
|||
"character", |
|||
"char", |
|||
"code", |
|||
"word" |
|||
], |
|||
"license": "MIT", |
|||
"name": "is-word-character", |
|||
"nyc": { |
|||
"check-coverage": true, |
|||
"lines": 100, |
|||
"functions": 100, |
|||
"branches": 100 |
|||
}, |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"plugins": [ |
|||
"comment-config", |
|||
"github", |
|||
"lint", |
|||
"validate-links" |
|||
], |
|||
"settings": { |
|||
"bullet": "*" |
|||
} |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/is-word-character.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.js --bare -s isWordCharacter > is-word-character.js", |
|||
"build-mangle": "esmangle < is-word-character.js > is-word-character.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.0.0", |
|||
"xo": { |
|||
"space": true, |
|||
"ignores": [ |
|||
"is-word-character.js", |
|||
"is-word-character.min.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,62 @@ |
|||
# is-word-character [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
<!--lint disable heading-increment list-item-spacing--> |
|||
|
|||
Check if a character is a word character (`\w`, which equals |
|||
`[a-zA-Z0-9_]`). |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install is-word-character |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```javascript |
|||
var wordCharacter = require('is-word-character'); |
|||
|
|||
wordCharacter('a'); // true |
|||
wordCharacter('Z'); // true |
|||
wordCharacter('0'); // true |
|||
wordCharacter('_'); // true |
|||
wordCharacter(' '); // false |
|||
wordCharacter('💩'); // false |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `wordCharacter(character)` |
|||
|
|||
Check whether the given character code (`number`), or the character |
|||
code at the first position (`string`), is a word character. |
|||
|
|||
## Related |
|||
|
|||
* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) |
|||
* [`is-alphanumerical`](https://github.com/wooorm/is-alphanumerical) |
|||
* [`is-decimal`](https://github.com/wooorm/is-decimal) |
|||
* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) |
|||
* [`is-whitespace-character`](https://github.com/wooorm/is-whitespace-character) |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/is-word-character.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/is-word-character |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/is-word-character.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/is-word-character |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
@ -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. |
@ -0,0 +1,6 @@ |
|||
<!--remark setext--> |
|||
|
|||
<!--lint disable no-multiple-toplevel-headings --> |
|||
|
|||
1.0.0 / 2016-07-16 |
|||
================== |
@ -0,0 +1,75 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2016 Titus Wormer |
|||
* @license MIT |
|||
* @module markdown-escapes |
|||
* @fileoverview List of escapable characters in markdown. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
/* eslint-env commonjs */ |
|||
|
|||
/* Expose. */ |
|||
module.exports = escapes; |
|||
|
|||
/* Characters. */ |
|||
var defaults = [ |
|||
'\\', |
|||
'`', |
|||
'*', |
|||
'{', |
|||
'}', |
|||
'[', |
|||
']', |
|||
'(', |
|||
')', |
|||
'#', |
|||
'+', |
|||
'-', |
|||
'.', |
|||
'!', |
|||
'_', |
|||
'>' |
|||
]; |
|||
|
|||
var gfm = defaults.concat(['~', '|']); |
|||
|
|||
var commonmark = gfm.concat([ |
|||
'\n', |
|||
'"', |
|||
'$', |
|||
'%', |
|||
'&', |
|||
'\'', |
|||
',', |
|||
'/', |
|||
':', |
|||
';', |
|||
'<', |
|||
'=', |
|||
'?', |
|||
'@', |
|||
'^' |
|||
]); |
|||
|
|||
/* Expose characters. */ |
|||
escapes.default = defaults; |
|||
escapes.gfm = gfm; |
|||
escapes.commonmark = commonmark; |
|||
|
|||
/** |
|||
* Get markdown escapes. |
|||
* |
|||
* @param {Object?} [options] - Configuration. |
|||
* @return {Array.<string>} - Escapes. |
|||
*/ |
|||
function escapes(options) { |
|||
var settings = options || {}; |
|||
|
|||
if (settings.commonmark) { |
|||
return commonmark; |
|||
} |
|||
|
|||
return settings.gfm ? gfm : defaults; |
|||
} |
@ -0,0 +1,109 @@ |
|||
{ |
|||
"_from": "markdown-escapes@^1.0.0", |
|||
"_id": "markdown-escapes@1.0.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-yMoZ8dlNaCRZ4Kk8htsnp+9xayM=", |
|||
"_location": "/markdown-escapes", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "markdown-escapes@^1.0.0", |
|||
"name": "markdown-escapes", |
|||
"escapedName": "markdown-escapes", |
|||
"rawSpec": "^1.0.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.0" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/remark-parse" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.0.tgz", |
|||
"_shasum": "c8ca19f1d94d682459e0a93c86db27a7ef716b23", |
|||
"_spec": "markdown-escapes@^1.0.0", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/markdown-escapes/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": {}, |
|||
"deprecated": false, |
|||
"description": "List of escapable characters in markdown", |
|||
"devDependencies": { |
|||
"browserify": "^13.0.1", |
|||
"esmangle": "^1.0.1", |
|||
"nyc": "^7.0.0", |
|||
"remark-cli": "^1.0.0", |
|||
"remark-comment-config": "^4.0.0", |
|||
"remark-github": "^5.0.0", |
|||
"remark-lint": "^4.0.0", |
|||
"remark-validate-links": "^4.0.0", |
|||
"tape": "^4.0.0", |
|||
"xo": "^0.16.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/wooorm/markdown-escapes#readme", |
|||
"keywords": [ |
|||
"markdown", |
|||
"escape", |
|||
"pedantic", |
|||
"gfm", |
|||
"commonmark" |
|||
], |
|||
"license": "MIT", |
|||
"name": "markdown-escapes", |
|||
"nyc": { |
|||
"check-coverage": true, |
|||
"lines": 100, |
|||
"functions": 100, |
|||
"branches": 100 |
|||
}, |
|||
"remarkConfig": { |
|||
"output": true, |
|||
"plugins": [ |
|||
"comment-config", |
|||
"github", |
|||
"lint", |
|||
"validate-links" |
|||
], |
|||
"settings": { |
|||
"bullet": "*" |
|||
} |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/markdown-escapes.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.js --bare -s markdownEscapes > markdown-escapes.js", |
|||
"build-mangle": "esmangle < markdown-escapes.js > markdown-escapes.min.js", |
|||
"build-md": "remark . --quiet --frail", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.0.0", |
|||
"xo": { |
|||
"space": true, |
|||
"ignores": [ |
|||
"markdown-escapes.js", |
|||
"markdown-escapes.min.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,71 @@ |
|||
# markdown-escapes [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] |
|||
|
|||
<!--lint disable heading-increment no-duplicate-headings--> |
|||
|
|||
List of escapable characters in markdown. |
|||
|
|||
## Installation |
|||
|
|||
[npm][npm-install]: |
|||
|
|||
```bash |
|||
npm install markdown-escapes |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```javascript |
|||
var escapes = require('markdown-escapes'); |
|||
|
|||
// Access by property: |
|||
escapes.commonmark; |
|||
// ['\\', '`', ..., '@', '^'] |
|||
|
|||
// Access by options object: |
|||
escapes({gfm: true}); |
|||
// ['\\', '`', ..., '~', '|'] |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### `escapes([options])` |
|||
|
|||
Get escapes. Supports `options.commonmark` and `options.gfm`, which |
|||
when `true` returns the extra escape characters supported by those |
|||
flavours. |
|||
|
|||
###### Returns |
|||
|
|||
`Array.<string>`. |
|||
|
|||
### `escapes.default` |
|||
|
|||
List of default escapable characters. |
|||
|
|||
### `escapes.gfm` |
|||
|
|||
List of escapable characters in GFM (which includes all `default`s). |
|||
|
|||
### `escapes.commonmark` |
|||
|
|||
List of escapable characters in CommonMark (which includes all `gfm`s). |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[travis-badge]: https://img.shields.io/travis/wooorm/markdown-escapes.svg |
|||
|
|||
[travis]: https://travis-ci.org/wooorm/markdown-escapes |
|||
|
|||
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/markdown-escapes.svg |
|||
|
|||
[codecov]: https://codecov.io/github/wooorm/markdown-escapes |
|||
|
|||
[npm-install]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
@ -0,0 +1,22 @@ |
|||
(The MIT License) |
|||
|
|||
Copyright (c) 2015 Titus Wormer <mailto: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. |
@ -0,0 +1,473 @@ |
|||
'use strict'; |
|||
|
|||
/* Dependencies. */ |
|||
var characterEntities = require('character-entities'); |
|||
var legacy = require('character-entities-legacy'); |
|||
var invalid = require('character-reference-invalid'); |
|||
var decimal = require('is-decimal'); |
|||
var hexadecimal = require('is-hexadecimal'); |
|||
var alphanumerical = require('is-alphanumerical'); |
|||
|
|||
/* Expose. */ |
|||
module.exports = wrapper; |
|||
|
|||
/* Methods. */ |
|||
var own = {}.hasOwnProperty; |
|||
var fromCharCode = String.fromCharCode; |
|||
var noop = Function.prototype; |
|||
|
|||
/* Characters. */ |
|||
var REPLACEMENT = '\uFFFD'; |
|||
var FORM_FEED = '\f'; |
|||
var AMPERSAND = '&'; |
|||
var OCTOTHORP = '#'; |
|||
var SEMICOLON = ';'; |
|||
var NEWLINE = '\n'; |
|||
var X_LOWER = 'x'; |
|||
var X_UPPER = 'X'; |
|||
var SPACE = ' '; |
|||
var LESS_THAN = '<'; |
|||
var EQUAL = '='; |
|||
var EMPTY = ''; |
|||
var TAB = '\t'; |
|||
|
|||
/* Default settings. */ |
|||
var defaults = { |
|||
warning: null, |
|||
reference: null, |
|||
text: null, |
|||
warningContext: null, |
|||
referenceContext: null, |
|||
textContext: null, |
|||
position: {}, |
|||
additional: null, |
|||
attribute: false, |
|||
nonTerminated: true |
|||
}; |
|||
|
|||
/* Reference types. */ |
|||
var NAMED = 'named'; |
|||
var HEXADECIMAL = 'hexadecimal'; |
|||
var DECIMAL = 'decimal'; |
|||
|
|||
/* Map of bases. */ |
|||
var BASE = {}; |
|||
|
|||
BASE[HEXADECIMAL] = 16; |
|||
BASE[DECIMAL] = 10; |
|||
|
|||
/* Map of types to tests. Each type of character reference |
|||
* accepts different characters. This test is used to |
|||
* detect whether a reference has ended (as the semicolon |
|||
* is not strictly needed). */ |
|||
var TESTS = {}; |
|||
|
|||
TESTS[NAMED] = alphanumerical; |
|||
TESTS[DECIMAL] = decimal; |
|||
TESTS[HEXADECIMAL] = hexadecimal; |
|||
|
|||
/* Warning messages. */ |
|||
var NAMED_NOT_TERMINATED = 1; |
|||
var NUMERIC_NOT_TERMINATED = 2; |
|||
var NAMED_EMPTY = 3; |
|||
var NUMERIC_EMPTY = 4; |
|||
var NAMED_UNKNOWN = 5; |
|||
var NUMERIC_DISALLOWED = 6; |
|||
var NUMERIC_PROHIBITED = 7; |
|||
|
|||
var NUMERIC_REFERENCE = 'Numeric character references'; |
|||
var NAMED_REFERENCE = 'Named character references'; |
|||
var TERMINATED = ' must be terminated by a semicolon'; |
|||
var VOID = ' cannot be empty'; |
|||
|
|||
var MESSAGES = {}; |
|||
|
|||
MESSAGES[NAMED_NOT_TERMINATED] = NAMED_REFERENCE + TERMINATED; |
|||
MESSAGES[NUMERIC_NOT_TERMINATED] = NUMERIC_REFERENCE + TERMINATED; |
|||
MESSAGES[NAMED_EMPTY] = NAMED_REFERENCE + VOID; |
|||
MESSAGES[NUMERIC_EMPTY] = NUMERIC_REFERENCE + VOID; |
|||
MESSAGES[NAMED_UNKNOWN] = NAMED_REFERENCE + ' must be known'; |
|||
MESSAGES[NUMERIC_DISALLOWED] = NUMERIC_REFERENCE + ' cannot be disallowed'; |
|||
MESSAGES[NUMERIC_PROHIBITED] = NUMERIC_REFERENCE + ' cannot be outside the ' + |
|||
'permissible Unicode range'; |
|||
|
|||
/* Wrap to ensure clean parameters are given to `parse`. */ |
|||
function wrapper(value, options) { |
|||
var settings = {}; |
|||
var option; |
|||
var key; |
|||
|
|||
if (!options) { |
|||
options = {}; |
|||
} |
|||
|
|||
for (key in defaults) { |
|||
option = options[key]; |
|||
settings[key] = option === null || option === undefined ? defaults[key] : option; |
|||
} |
|||
|
|||
if (settings.position.indent || settings.position.start) { |
|||
settings.indent = settings.position.indent || []; |
|||
settings.position = settings.position.start; |
|||
} |
|||
|
|||
return parse(value, settings); |
|||
} |
|||
|
|||
/* Parse entities. */ |
|||
function parse(value, settings) { |
|||
var additional = settings.additional; |
|||
var nonTerminated = settings.nonTerminated; |
|||
var handleText = settings.text; |
|||
var handleReference = settings.reference; |
|||
var handleWarning = settings.warning; |
|||
var textContext = settings.textContext; |
|||
var referenceContext = settings.referenceContext; |
|||
var warningContext = settings.warningContext; |
|||
var pos = settings.position; |
|||
var indent = settings.indent || []; |
|||
var length = value.length; |
|||
var index = 0; |
|||
var lines = -1; |
|||
var column = pos.column || 1; |
|||
var line = pos.line || 1; |
|||
var queue = EMPTY; |
|||
var result = []; |
|||
var entityCharacters; |
|||
var terminated; |
|||
var characters; |
|||
var character; |
|||
var reference; |
|||
var following; |
|||
var warning; |
|||
var reason; |
|||
var output; |
|||
var entity; |
|||
var begin; |
|||
var start; |
|||
var type; |
|||
var test; |
|||
var prev; |
|||
var next; |
|||
var diff; |
|||
var end; |
|||
|
|||
/* Cache the current point. */ |
|||
prev = now(); |
|||
|
|||
/* Wrap `handleWarning`. */ |
|||
warning = handleWarning ? parseError : noop; |
|||
|
|||
/* Ensure the algorithm walks over the first character |
|||
* and the end (inclusive). */ |
|||
index--; |
|||
length++; |
|||
|
|||
while (++index < length) { |
|||
/* If the previous character was a newline. */ |
|||
if (character === NEWLINE) { |
|||
column = indent[lines] || 1; |
|||
} |
|||
|
|||
character = at(index); |
|||
|
|||
/* Handle anything other than an ampersand, |
|||
* including newlines and EOF. */ |
|||
if (character !== AMPERSAND) { |
|||
if (character === NEWLINE) { |
|||
line++; |
|||
lines++; |
|||
column = 0; |
|||
} |
|||
|
|||
if (character) { |
|||
queue += character; |
|||
column++; |
|||
} else { |
|||
flush(); |
|||
} |
|||
} else { |
|||
following = at(index + 1); |
|||
|
|||
/* The behaviour depends on the identity of the next |
|||
* character. */ |
|||
if ( |
|||
following === TAB || |
|||
following === NEWLINE || |
|||
following === FORM_FEED || |
|||
following === SPACE || |
|||
following === LESS_THAN || |
|||
following === AMPERSAND || |
|||
following === EMPTY || |
|||
(additional && following === additional) |
|||
) { |
|||
/* Not a character reference. No characters |
|||
* are consumed, and nothing is returned. |
|||
* This is not an error, either. */ |
|||
queue += character; |
|||
column++; |
|||
|
|||
continue; |
|||
} |
|||
|
|||
start = index + 1; |
|||
begin = start; |
|||
end = start; |
|||
|
|||
/* Numerical entity. */ |
|||
if (following !== OCTOTHORP) { |
|||
type = NAMED; |
|||
} else { |
|||
end = ++begin; |
|||
|
|||
/* The behaviour further depends on the |
|||
* character after the U+0023 NUMBER SIGN. */ |
|||
following = at(end); |
|||
|
|||
if (following === X_LOWER || following === X_UPPER) { |
|||
/* ASCII hex digits. */ |
|||
type = HEXADECIMAL; |
|||
end = ++begin; |
|||
} else { |
|||
/* ASCII digits. */ |
|||
type = DECIMAL; |
|||
} |
|||
} |
|||
|
|||
entityCharacters = EMPTY; |
|||
entity = EMPTY; |
|||
characters = EMPTY; |
|||
test = TESTS[type]; |
|||
end--; |
|||
|
|||
while (++end < length) { |
|||
following = at(end); |
|||
|
|||
if (!test(following)) { |
|||
break; |
|||
} |
|||
|
|||
characters += following; |
|||
|
|||
/* Check if we can match a legacy named |
|||
* reference. If so, we cache that as the |
|||
* last viable named reference. This |
|||
* ensures we do not need to walk backwards |
|||
* later. */ |
|||
if (type === NAMED && own.call(legacy, characters)) { |
|||
entityCharacters = characters; |
|||
entity = legacy[characters]; |
|||
} |
|||
} |
|||
|
|||
terminated = at(end) === SEMICOLON; |
|||
|
|||
if (terminated) { |
|||
end++; |
|||
|
|||
if (type === NAMED && own.call(characterEntities, characters)) { |
|||
entityCharacters = characters; |
|||
entity = characterEntities[characters]; |
|||
} |
|||
} |
|||
|
|||
diff = 1 + end - start; |
|||
|
|||
if (!terminated && !nonTerminated) { |
|||
/* Empty. */ |
|||
} else if (!characters) { |
|||
/* An empty (possible) entity is valid, unless |
|||
* its numeric (thus an ampersand followed by |
|||
* an octothorp). */ |
|||
if (type !== NAMED) { |
|||
warning(NUMERIC_EMPTY, diff); |
|||
} |
|||
} else if (type === NAMED) { |
|||
/* An ampersand followed by anything |
|||
* unknown, and not terminated, is invalid. */ |
|||
if (terminated && !entity) { |
|||
warning(NAMED_UNKNOWN, 1); |
|||
} else { |
|||
/* If theres something after an entity |
|||
* name which is not known, cap the |
|||
* reference. */ |
|||
if (entityCharacters !== characters) { |
|||
end = begin + entityCharacters.length; |
|||
diff = 1 + end - begin; |
|||
terminated = false; |
|||
} |
|||
|
|||
/* If the reference is not terminated, |
|||
* warn. */ |
|||
if (!terminated) { |
|||
reason = entityCharacters ? |
|||
NAMED_NOT_TERMINATED : |
|||
NAMED_EMPTY; |
|||
|
|||
if (!settings.attribute) { |
|||
warning(reason, diff); |
|||
} else { |
|||
following = at(end); |
|||
|
|||
if (following === EQUAL) { |
|||
warning(reason, diff); |
|||
entity = null; |
|||
} else if (alphanumerical(following)) { |
|||
entity = null; |
|||
} else { |
|||
warning(reason, diff); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
reference = entity; |
|||
} else { |
|||
if (!terminated) { |
|||
/* All non-terminated numeric entities are |
|||
* not rendered, and trigger a warning. */ |
|||
warning(NUMERIC_NOT_TERMINATED, diff); |
|||
} |
|||
|
|||
/* When terminated and number, parse as |
|||
* either hexadecimal or decimal. */ |
|||
reference = parseInt(characters, BASE[type]); |
|||
|
|||
/* Trigger a warning when the parsed number |
|||
* is prohibited, and replace with |
|||
* replacement character. */ |
|||
if (isProhibited(reference)) { |
|||
warning(NUMERIC_PROHIBITED, diff); |
|||
|
|||
reference = REPLACEMENT; |
|||
} else if (reference in invalid) { |
|||
/* Trigger a warning when the parsed number |
|||
* is disallowed, and replace by an |
|||
* alternative. */ |
|||
warning(NUMERIC_DISALLOWED, diff); |
|||
|
|||
reference = invalid[reference]; |
|||
} else { |
|||
/* Parse the number. */ |
|||
output = EMPTY; |
|||
|
|||
/* Trigger a warning when the parsed |
|||
* number should not be used. */ |
|||
if (isWarning(reference)) { |
|||
warning(NUMERIC_DISALLOWED, diff); |
|||
} |
|||
|
|||
/* Stringify the number. */ |
|||
if (reference > 0xFFFF) { |
|||
reference -= 0x10000; |
|||
output += fromCharCode((reference >>> (10 & 0x3FF)) | 0xD800); |
|||
reference = 0xDC00 | (reference & 0x3FF); |
|||
} |
|||
|
|||
reference = output + fromCharCode(reference); |
|||
} |
|||
} |
|||
|
|||
/* If we could not find a reference, queue the |
|||
* checked characters (as normal characters), |
|||
* and move the pointer to their end. This is |
|||
* possible because we can be certain neither |
|||
* newlines nor ampersands are included. */ |
|||
if (!reference) { |
|||
characters = value.slice(start - 1, end); |
|||
queue += characters; |
|||
column += characters.length; |
|||
index = end - 1; |
|||
} else { |
|||
/* Found it! First eat the queued |
|||
* characters as normal text, then eat |
|||
* an entity. */ |
|||
flush(); |
|||
|
|||
prev = now(); |
|||
index = end - 1; |
|||
column += end - start + 1; |
|||
result.push(reference); |
|||
next = now(); |
|||
next.offset++; |
|||
|
|||
if (handleReference) { |
|||
handleReference.call(referenceContext, reference, { |
|||
start: prev, |
|||
end: next |
|||
}, value.slice(start - 1, end)); |
|||
} |
|||
|
|||
prev = next; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* Return the reduced nodes, and any possible warnings. */ |
|||
return result.join(EMPTY); |
|||
|
|||
/* Get current position. */ |
|||
function now() { |
|||
return { |
|||
line: line, |
|||
column: column, |
|||
offset: index + (pos.offset || 0) |
|||
}; |
|||
} |
|||
|
|||
/* “Throw” a parse-error: a warning. */ |
|||
function parseError(code, offset) { |
|||
var position = now(); |
|||
|
|||
position.column += offset; |
|||
position.offset += offset; |
|||
|
|||
handleWarning.call(warningContext, MESSAGES[code], position, code); |
|||
} |
|||
|
|||
/* Get character at position. */ |
|||
function at(position) { |
|||
return value.charAt(position); |
|||
} |
|||
|
|||
/* Flush `queue` (normal text). Macro invoked before |
|||
* each entity and at the end of `value`. |
|||
* Does nothing when `queue` is empty. */ |
|||
function flush() { |
|||
if (queue) { |
|||
result.push(queue); |
|||
|
|||
if (handleText) { |
|||
handleText.call(textContext, queue, { |
|||
start: prev, |
|||
end: now() |
|||
}); |
|||
} |
|||
|
|||
queue = EMPTY; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* Check if `character` is outside the permissible |
|||
* unicode range. */ |
|||
function isProhibited(code) { |
|||
return (code >= 0xD800 && code <= 0xDFFF) || (code > 0x10FFFF); |
|||
} |
|||
|
|||
/* Check if `character` is disallowed. */ |
|||
function isWarning(code) { |
|||
if ( |
|||
(code >= 0x0001 && code <= 0x0008) || |
|||
code === 0x000B || |
|||
(code >= 0x000D && code <= 0x001F) || |
|||
(code >= 0x007F && code <= 0x009F) || |
|||
(code >= 0xFDD0 && code <= 0xFDEF) || |
|||
(code & 0xFFFF) === 0xFFFF || |
|||
(code & 0xFFFF) === 0xFFFE |
|||
) { |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
@ -0,0 +1,113 @@ |
|||
{ |
|||
"_from": "parse-entities@^1.0.2", |
|||
"_id": "parse-entities@1.1.1", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-gRLYhHExnyerrk1klksSL+ThuJA=", |
|||
"_location": "/parse-entities", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "parse-entities@^1.0.2", |
|||
"name": "parse-entities", |
|||
"escapedName": "parse-entities", |
|||
"rawSpec": "^1.0.2", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^1.0.2" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/remark-parse" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.1.1.tgz", |
|||
"_shasum": "8112d88471319f27abae4d64964b122fe4e1b890", |
|||
"_spec": "parse-entities@^1.0.2", |
|||
"_where": "j:\\temp\\_git\\node-fork\\tools\\eslint\\node_modules\\remark-parse", |
|||
"author": { |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
}, |
|||
"bugs": { |
|||
"url": "https://github.com/wooorm/parse-entities/issues" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"contributors": [ |
|||
{ |
|||
"name": "Titus Wormer", |
|||
"email": "tituswormer@gmail.com", |
|||
"url": "http://wooorm.com" |
|||
} |
|||
], |
|||
"dependencies": { |
|||
"character-entities": "^1.0.0", |
|||
"character-entities-legacy": "^1.0.0", |
|||
"character-reference-invalid": "^1.0.0", |
|||
"is-alphanumerical": "^1.0.0", |
|||
"is-decimal": "^1.0.0", |
|||
"is-hexadecimal": "^1.0.0" |
|||
}, |
|||
"deprecated": false, |
|||
"description": "Parse HTML character references: fast, spec-compliant, positional information", |
|||
"devDependencies": { |
|||
"browserify": "^14.0.0", |
|||
"esmangle": "^1.0.0", |
|||
"nyc": "^11.0.0", |
|||
"remark-cli": "^3.0.0", |
|||
"remark-preset-wooorm": "^3.0.0", |
|||
"tape": "^4.2.0", |
|||
"xo": "^0.18.0" |
|||
}, |
|||
"files": [ |
|||
"index.js" |
|||
], |
|||
"homepage": "https://github.com/wooorm/parse-entities#readme", |
|||
"keywords": [ |
|||
"parse", |
|||
"html", |
|||
"character", |
|||
"reference", |
|||
"entity", |
|||
"entities" |
|||
], |
|||
"license": "MIT", |
|||
"name": "parse-entities", |
|||
"nyc": { |
|||
"check-coverage": true, |
|||
"lines": 100, |
|||
"functions": 100, |
|||
"branches": 100 |
|||
}, |
|||
"remarkConfig": { |
|||
"plugins": [ |
|||
"preset-wooorm" |
|||
] |
|||
}, |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "git+https://github.com/wooorm/parse-entities.git" |
|||
}, |
|||
"scripts": { |
|||
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", |
|||
"build-bundle": "browserify index.js --bare -s parseEntities > parse-entities.js", |
|||
"build-mangle": "esmangle parse-entities.js > parse-entities.min.js", |
|||
"build-md": "remark . -qfo", |
|||
"lint": "xo", |
|||
"test": "npm run build && npm run lint && npm run test-coverage", |
|||
"test-api": "node test.js", |
|||
"test-coverage": "nyc --reporter lcov tape test.js" |
|||
}, |
|||
"version": "1.1.1", |
|||
"xo": { |
|||
"space": true, |
|||
"esnext": false, |
|||
"rules": { |
|||
"guard-for-in": "off", |
|||
"no-negated-condition": "off", |
|||
"max-depth": "off", |
|||
"complexity": "off" |
|||
}, |
|||
"ignores": [ |
|||
"parse-entities.js" |
|||
] |
|||
} |
|||
} |
@ -0,0 +1,157 @@ |
|||
# parse-entities [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] |
|||
|
|||
Parse HTML character references: fast, spec-compliant, positional |
|||
information. |
|||
|
|||
## Installation |
|||
|
|||
[npm][]: |
|||
|
|||
```bash |
|||
npm install parse-entities |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```js |
|||
var decode = require('parse-entities'); |
|||
|
|||
decode('alpha & bravo'); |
|||
//=> alpha & bravo |
|||
|
|||
decode('charlie ©cat; delta'); |
|||
//=> charlie ©cat; delta |
|||
|
|||
decode('echo © foxtrot ≠ golf 𝌆 hotel'); |
|||
//=> echo © foxtrot ≠ golf 𝌆 hotel |
|||
``` |
|||
|
|||
## API |
|||
|
|||
## `parseEntities(value[, options])` |
|||
|
|||
###### `options` |
|||
|
|||
* `additional` (`string`, optional, default: `''`) |
|||
— Additional character to accept when following an ampersand (without |
|||
error) |
|||
* `attribute` (`boolean`, optional, default: `false`) |
|||
— Whether to parse `value` as an attribute value |
|||
* `nonTerminated` (`boolean`, default: `true`) |
|||
— Whether to allow non-terminated entities, such as `©cat` to |
|||
`©cat`. This behaviour is spec-compliant but can lead to unexpected |
|||
results |
|||
* `warning` ([`Function`][warning], optional) |
|||
— Error handler |
|||
* `text` ([`Function`][text], optional) |
|||
— Text handler |
|||
* `reference` ([`Function`][reference], |
|||
optional) — Reference handler |
|||
* `warningContext` (`'*'`, optional) |
|||
— Context used when invoking `warning` |
|||
* `textContext` (`'*'`, optional) |
|||
— Context used when invoking `text` |
|||
* `referenceContext` (`'*'`, optional) |
|||
— Context used when invoking `reference` |
|||
* `position` (`Location` or `Position`, optional) |
|||
— Starting `position` of `value`, useful when dealing with values |
|||
nested in some sort of syntax tree. The default is: |
|||
|
|||
```json |
|||
{ |
|||
"start": { |
|||
"line": 1, |
|||
"column": 1, |
|||
"offset": 0 |
|||
}, |
|||
"indent": [] |
|||
} |
|||
``` |
|||
|
|||
###### Returns |
|||
|
|||
`string` — Decoded `value`. |
|||
|
|||
### `function warning(reason, position, code)` |
|||
|
|||
Error handler. |
|||
|
|||
###### Context |
|||
|
|||
`this` refers to `warningContext` when given to `parseEntities`. |
|||
|
|||
###### Parameters |
|||
|
|||
* `reason` (`string`) |
|||
— Reason (human-readable) for triggering a parse error |
|||
* `position` (`Position`) |
|||
— Place at which the parse error occurred |
|||
* `code` (`number`) |
|||
— Identifier of reason for triggering a parse error |
|||
|
|||
The following codes are used: |
|||
|
|||
| Code | Example | Note | |
|||
| ---- | ------------------ | --------------------------------------------- | |
|||
| `1` | `foo & bar` | Missing semicolon (named) | |
|||
| `2` | `foo { bar` | Missing semicolon (numeric) | |
|||
| `3` | `Foo &bar baz` | Ampersand did not start a reference | |
|||
| `4` | `Foo &#` | Empty reference | |
|||
| `5` | `Foo &bar; baz` | Unknown entity | |
|||
| `6` | `Foo € baz` | [Disallowed reference][invalid] | |
|||
| `7` | `Foo � baz` | Prohibited: outside permissible unicode range | |
|||
|
|||
###### `function text(value, location)` |
|||
|
|||
Text handler. |
|||
|
|||
###### Context |
|||
|
|||
`this` refers to `textContext` when given to `parseEntities`. |
|||
|
|||
###### Parameters |
|||
|
|||
* `value` (`string`) — String of content |
|||
* `location` (`Location`) — Location at which `value` starts and ends |
|||
|
|||
### `function reference(value, location, source)` |
|||
|
|||
Character reference handler. |
|||
|
|||
###### Context |
|||
|
|||
`this` refers to `referenceContext` when given to `parseEntities`. |
|||
|
|||
###### Parameters |
|||
|
|||
* `value` (`string`) — Encoded character reference |
|||
* `location` (`Location`) — Location at which `value` starts and ends |
|||
* `source` (`Location`) — Source of character reference |
|||
|
|||
## License |
|||
|
|||
[MIT][license] © [Titus Wormer][author] |
|||
|
|||
<!-- Definitions --> |
|||
|
|||
[build-badge]: https://img.shields.io/travis/wooorm/parse-entities.svg |
|||
|
|||
[build-status]: https://travis-ci.org/wooorm/parse-entities |
|||
|
|||
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/parse-entities.svg |
|||
|
|||
[coverage-status]: https://codecov.io/github/wooorm/parse-entities |
|||
|
|||
[npm]: https://docs.npmjs.com/cli/install |
|||
|
|||
[license]: LICENSE |
|||
|
|||
[author]: http://wooorm.com |
|||
|
|||
[warning]: #function-warningreason-position-code |
|||
|
|||
[text]: #function-textvalue-location |
|||
|
|||
[reference]: #function-referencevalue-location-source |
|||
|
|||
[invalid]: https://github.com/wooorm/character-reference-invalid |
@ -0,0 +1,14 @@ |
|||
'use strict'; |
|||
|
|||
var unherit = require('unherit'); |
|||
var xtend = require('xtend'); |
|||
var Parser = require('./lib/parser.js'); |
|||
|
|||
module.exports = parse; |
|||
parse.Parser = Parser; |
|||
|
|||
function parse(options) { |
|||
var Local = unherit(Parser); |
|||
Local.prototype.options = xtend(Local.prototype.options, this.data('settings'), options); |
|||
this.Parser = Local; |
|||
} |
@ -0,0 +1,68 @@ |
|||
[ |
|||
"address", |
|||
"article", |
|||
"aside", |
|||
"base", |
|||
"basefont", |
|||
"blockquote", |
|||
"body", |
|||
"caption", |
|||
"center", |
|||
"col", |
|||
"colgroup", |
|||
"dd", |
|||
"details", |
|||
"dialog", |
|||
"dir", |
|||
"div", |
|||
"dl", |
|||
"dt", |
|||
"fieldset", |
|||
"figcaption", |
|||
"figure", |
|||
"footer", |
|||
"form", |
|||
"frame", |
|||
"frameset", |
|||
"h1", |
|||
"h2", |
|||
"h3", |
|||
"h4", |
|||
"h5", |
|||
"h6", |
|||
"head", |
|||
"header", |
|||
"hgroup", |
|||
"hr", |
|||
"html", |
|||
"iframe", |
|||
"legend", |
|||
"li", |
|||
"link", |
|||
"main", |
|||
"menu", |
|||
"menuitem", |
|||
"meta", |
|||
"nav", |
|||
"noframes", |
|||
"ol", |
|||
"optgroup", |
|||
"option", |
|||
"p", |
|||
"param", |
|||
"pre", |
|||
"section", |
|||
"source", |
|||
"title", |
|||
"summary", |
|||
"table", |
|||
"tbody", |
|||
"td", |
|||
"tfoot", |
|||
"th", |
|||
"thead", |
|||
"title", |
|||
"tr", |
|||
"track", |
|||
"ul" |
|||
] |
@ -0,0 +1,71 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2015 Titus Wormer |
|||
* @license MIT |
|||
* @module remark:parse:decode |
|||
* @fileoverview Decode entities. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
var entities = require('parse-entities'); |
|||
|
|||
module.exports = factory; |
|||
|
|||
/* Factory to create an entity decoder. */ |
|||
function factory(ctx) { |
|||
decoder.raw = decodeRaw; |
|||
|
|||
return decoder; |
|||
|
|||
/* Normalize `position` to add an `indent`. */ |
|||
function normalize(position) { |
|||
var offsets = ctx.offset; |
|||
var line = position.line; |
|||
var result = []; |
|||
|
|||
while (++line) { |
|||
if (!(line in offsets)) { |
|||
break; |
|||
} |
|||
|
|||
result.push((offsets[line] || 0) + 1); |
|||
} |
|||
|
|||
return { |
|||
start: position, |
|||
indent: result |
|||
}; |
|||
} |
|||
|
|||
/* Handle a warning. |
|||
* See https://github.com/wooorm/parse-entities
|
|||
* for the warnings. */ |
|||
function handleWarning(reason, position, code) { |
|||
if (code === 3) { |
|||
return; |
|||
} |
|||
|
|||
ctx.file.message(reason, position); |
|||
} |
|||
|
|||
/* Decode `value` (at `position`) into text-nodes. */ |
|||
function decoder(value, position, handler) { |
|||
entities(value, { |
|||
position: normalize(position), |
|||
warning: handleWarning, |
|||
text: handler, |
|||
reference: handler, |
|||
textContext: ctx, |
|||
referenceContext: ctx |
|||
}); |
|||
} |
|||
|
|||
/* Decode `value` (at `position`) into a string. */ |
|||
function decodeRaw(value, position) { |
|||
return entities(value, { |
|||
position: normalize(position), |
|||
warning: handleWarning |
|||
}); |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2015 Titus Wormer |
|||
* @license MIT |
|||
* @module remark:parse:defaults |
|||
* @fileoverview Default options for `parse`. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
/* Expose. */ |
|||
module.exports = { |
|||
position: true, |
|||
gfm: true, |
|||
yaml: true, |
|||
commonmark: false, |
|||
footnotes: false, |
|||
pedantic: false, |
|||
blocks: require('./block-elements'), |
|||
breaks: false |
|||
}; |
@ -0,0 +1,25 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2015 Titus Wormer |
|||
* @license MIT |
|||
* @module remark:parse:locate:break |
|||
* @fileoverview Locate a break. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = locate; |
|||
|
|||
function locate(value, fromIndex) { |
|||
var index = value.indexOf('\n', fromIndex); |
|||
|
|||
while (index > fromIndex) { |
|||
if (value.charAt(index - 1) !== ' ') { |
|||
break; |
|||
} |
|||
|
|||
index--; |
|||
} |
|||
|
|||
return index; |
|||
} |
@ -0,0 +1,15 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2015 Titus Wormer |
|||
* @license MIT |
|||
* @module remark:parse:locate:code-inline |
|||
* @fileoverview Locate inline code. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = locate; |
|||
|
|||
function locate(value, fromIndex) { |
|||
return value.indexOf('`', fromIndex); |
|||
} |
@ -0,0 +1,15 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2015 Titus Wormer |
|||
* @license MIT |
|||
* @module remark:parse:locate:delete |
|||
* @fileoverview Locate strikethrough. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = locate; |
|||
|
|||
function locate(value, fromIndex) { |
|||
return value.indexOf('~~', fromIndex); |
|||
} |
@ -0,0 +1,26 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2015 Titus Wormer |
|||
* @license MIT |
|||
* @module remark:parse:locate:emphasis |
|||
* @fileoverview Locate italics / emphasis. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = locate; |
|||
|
|||
function locate(value, fromIndex) { |
|||
var asterisk = value.indexOf('*', fromIndex); |
|||
var underscore = value.indexOf('_', fromIndex); |
|||
|
|||
if (underscore === -1) { |
|||
return asterisk; |
|||
} |
|||
|
|||
if (asterisk === -1) { |
|||
return underscore; |
|||
} |
|||
|
|||
return underscore < asterisk ? underscore : asterisk; |
|||
} |
@ -0,0 +1,15 @@ |
|||
/** |
|||
* @author Titus Wormer |
|||
* @copyright 2015 Titus Wormer |
|||
* @license MIT |
|||
* @module remark:parse:locate:escape |
|||
* @fileoverview Locate an escape. |
|||
*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = locate; |
|||
|
|||
function locate(value, fromIndex) { |
|||
return value.indexOf('\\', fromIndex); |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue