$
This commit is contained in:
20
node_modules/unicode-match-property-value-ecmascript/LICENSE-MIT.txt
generated
vendored
Normal file
20
node_modules/unicode-match-property-value-ecmascript/LICENSE-MIT.txt
generated
vendored
Normal file
@@ -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.
|
||||
72
node_modules/unicode-match-property-value-ecmascript/README.md
generated
vendored
Normal file
72
node_modules/unicode-match-property-value-ecmascript/README.md
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
# unicode-match-property-value-ecmascript [](https://travis-ci.org/mathiasbynens/unicode-match-property-value-ecmascript) [](https://www.npmjs.com/package/unicode-match-property-value-ecmascript)
|
||||
|
||||
_unicode-match-property-value-ecmascript_ matches a given Unicode property value or [property value alias](https://github.com/mathiasbynens/unicode-property-value-aliases) to its canonical property value 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-value-ecmascript_ programmatically, install it as a dependency via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
$ npm install unicode-match-property-value-ecmascript
|
||||
```
|
||||
|
||||
Then, `require` it:
|
||||
|
||||
```js
|
||||
const matchPropertyValue = require('unicode-match-property-value-ecmascript');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This module exports a single function named `matchPropertyValue`.
|
||||
|
||||
### `matchPropertyValue(property, value)`
|
||||
|
||||
This function takes a string `property` that is a canonical/unaliased Unicode property name, and a string `value`. It attemps to match `value` to a canonical Unicode property value for the given property. If there’s a match, it returns the canonical property value. Otherwise, it throws an exception.
|
||||
|
||||
```js
|
||||
// Find the canonical property value:
|
||||
matchPropertyValue('Script_Extensions', 'Aghb')
|
||||
// → 'Caucasian_Albanian'
|
||||
|
||||
matchPropertyValue('Script_Extensions', 'Caucasian_Albanian')
|
||||
// → 'Caucasian_Albanian'
|
||||
|
||||
matchPropertyValue('script_extensions', 'Caucasian_Albanian') // Note: incorrect casing.
|
||||
// → throws
|
||||
|
||||
matchPropertyValue('Script_Extensions', 'caucasian_albanian') // Note: incorrect casing.
|
||||
// → throws
|
||||
```
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
_unicode-match-property-value-ecmascript_ is available under the [MIT](https://mths.be/mit) license.
|
||||
730
node_modules/unicode-match-property-value-ecmascript/data/mappings.js
generated
vendored
Normal file
730
node_modules/unicode-match-property-value-ecmascript/data/mappings.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
19
node_modules/unicode-match-property-value-ecmascript/index.js
generated
vendored
Normal file
19
node_modules/unicode-match-property-value-ecmascript/index.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
const propertyToValueAliases = require('./data/mappings.js');
|
||||
|
||||
const matchPropertyValue = function(property, value) {
|
||||
const aliasToValue = propertyToValueAliases.get(property);
|
||||
if (!aliasToValue) {
|
||||
throw new Error(`Unknown property \`${ property }\`.`);
|
||||
}
|
||||
const canonicalValue = aliasToValue.get(value);
|
||||
if (canonicalValue) {
|
||||
return canonicalValue;
|
||||
}
|
||||
throw new Error(
|
||||
`Unknown value \`${ value }\` for property \`${ property }\`.`
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = matchPropertyValue;
|
||||
39
node_modules/unicode-match-property-value-ecmascript/package.json
generated
vendored
Normal file
39
node_modules/unicode-match-property-value-ecmascript/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "unicode-match-property-value-ecmascript",
|
||||
"version": "2.0.0",
|
||||
"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-value-ecmascript",
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"data/mappings.js",
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"unicode",
|
||||
"unicode property values",
|
||||
"unicode property value aliases"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mathiasbynens/unicode-match-property-value-ecmascript.git"
|
||||
},
|
||||
"bugs": "https://github.com/mathiasbynens/unicode-match-property-value-ecmascript/issues",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"jsesc": "^3.0.2",
|
||||
"unicode-property-value-aliases-ecmascript": "^2.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js",
|
||||
"test": "ava tests/tests.js"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user