diff options
| author | ruki <waruqi@gmail.com> | 2018-11-08 00:38:48 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-11-07 21:53:09 +0800 |
| commit | 26105034da4fcce7ac883c899d781f016559310d (patch) | |
| tree | c459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/unicode-match-property-ecmascript | |
| parent | 2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff) | |
| download | xmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip | |
switch to vuepress
Diffstat (limited to 'node_modules/unicode-match-property-ecmascript')
4 files changed, 122 insertions, 0 deletions
diff --git a/node_modules/unicode-match-property-ecmascript/LICENSE-MIT.txt b/node_modules/unicode-match-property-ecmascript/LICENSE-MIT.txt new file mode 100644 index 00000000..a41e0a7e --- /dev/null +++ b/node_modules/unicode-match-property-ecmascript/LICENSE-MIT.txt @@ -0,0 +1,20 @@ +Copyright Mathias Bynens <https://mathiasbynens.be/> + +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. diff --git a/node_modules/unicode-match-property-ecmascript/README.md b/node_modules/unicode-match-property-ecmascript/README.md new file mode 100644 index 00000000..5f0e80e9 --- /dev/null +++ b/node_modules/unicode-match-property-ecmascript/README.md @@ -0,0 +1,47 @@ +# unicode-match-property-ecmascript [](https://travis-ci.org/mathiasbynens/unicode-match-property-ecmascript) + +_unicode-match-property-ecmascript_ matches a given Unicode property or [property alias](https://github.com/mathiasbynens/unicode-property-aliases-ecmascript) to its canonical property name without applying [loose matching](https://github.com/mathiasbynens/unicode-loose-match) per the algorithm used for [RegExp Unicode property escapes in ECMAScript](https://github.com/tc39/proposal-regexp-unicode-property-escapes). Consider it a strict alternative to loose matching. + +## Installation + +To use _unicode-match-property-ecmascript_ programmatically, install it as a dependency via [npm](https://www.npmjs.com/): + +```bash +$ npm install unicode-match-property-ecmascript +``` + +Then, `require` it: + +```js +const matchProperty = require('unicode-match-property-ecmascript'); +``` + +## API + +This module exports a single function named `matchProperty`. + +### `matchProperty(value)` + +This function takes a string `value` and attempts to match it to a canonical Unicode property name. If there’s a match, it returns the canonical property name. Otherwise, it throws an exception. + +```js +// Find the canonical property name: +matchProperty('sc') +// → 'Script' + +matchProperty('Script') +// → 'Script' + +matchProperty('script') // Note: incorrect casing. +// → throws +``` + +## Author + +| [](https://twitter.com/mathias "Follow @mathias on Twitter") | +|---| +| [Mathias Bynens](https://mathiasbynens.be/) | + +## License + +_unicode-match-property-ecmascript_ is available under the [MIT](https://mths.be/mit) license. diff --git a/node_modules/unicode-match-property-ecmascript/index.js b/node_modules/unicode-match-property-ecmascript/index.js new file mode 100755 index 00000000..65205934 --- /dev/null +++ b/node_modules/unicode-match-property-ecmascript/index.js @@ -0,0 +1,16 @@ +'use strict'; + +const canonicalProperties = require('unicode-canonical-property-names-ecmascript'); +const propertyAliases = require('unicode-property-aliases-ecmascript'); + +const matchProperty = function(property) { + if (canonicalProperties.has(property)) { + return property; + } + if (propertyAliases.has(property)) { + return propertyAliases.get(property); + } + throw new Error(`Unknown property: ${ property }`); +}; + +module.exports = matchProperty; diff --git a/node_modules/unicode-match-property-ecmascript/package.json b/node_modules/unicode-match-property-ecmascript/package.json new file mode 100644 index 00000000..9d7e8636 --- /dev/null +++ b/node_modules/unicode-match-property-ecmascript/package.json @@ -0,0 +1,39 @@ +{ + "name": "unicode-match-property-ecmascript", + "version": "1.0.4", + "description": "Match a Unicode property or property alias to its canonical property name per the algorithm used for RegExp Unicode property escapes in ECMAScript.", + "homepage": "https://github.com/mathiasbynens/unicode-match-property-ecmascript", + "main": "index.js", + "engines": { + "node": ">=4" + }, + "files": [ + "LICENSE-MIT.txt", + "index.js" + ], + "keywords": [ + "unicode", + "unicode properties", + "unicode property aliases" + ], + "license": "MIT", + "author": { + "name": "Mathias Bynens", + "url": "https://mathiasbynens.be/" + }, + "repository": { + "type": "git", + "url": "https://github.com/mathiasbynens/unicode-match-property-ecmascript.git" + }, + "bugs": "https://github.com/mathiasbynens/unicode-match-property-ecmascript/issues", + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + }, + "devDependencies": { + "ava": "*" + }, + "scripts": { + "test": "ava ./tests" + } +} |
