pax_global_header00006660000000000000000000000064133062273140014513gustar00rootroot0000000000000052 comment=297bcffae3d154e0691b995e2a3ea28f449eab51 unicode-match-property-ecmascript-1.0.4/000077500000000000000000000000001330622731400202475ustar00rootroot00000000000000unicode-match-property-ecmascript-1.0.4/.editorconfig000066400000000000000000000003161330622731400227240ustar00rootroot00000000000000root = true [*] charset = utf-8 indent_style = tab end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true [{README.md,package.json,.travis.yml}] indent_style = space indent_size = 2 unicode-match-property-ecmascript-1.0.4/.gitattributes000066400000000000000000000000141330622731400231350ustar00rootroot00000000000000* text=auto unicode-match-property-ecmascript-1.0.4/.gitignore000066400000000000000000000003351330622731400222400ustar00rootroot00000000000000# Installed npm modules node_modules package-lock.json # Folder view configuration files .DS_Store Desktop.ini # Thumbnail cache files ._* Thumbs.db # Files that might appear on external disks .Spotlight-V100 .Trashes unicode-match-property-ecmascript-1.0.4/.travis.yml000066400000000000000000000001131330622731400223530ustar00rootroot00000000000000language: node_js node_js: - '4' - '5' - '6' - '7' git: depth: 1 unicode-match-property-ecmascript-1.0.4/LICENSE-MIT.txt000066400000000000000000000020651330622731400225240ustar00rootroot00000000000000Copyright Mathias Bynens 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. unicode-match-property-ecmascript-1.0.4/README.md000066400000000000000000000034101330622731400215240ustar00rootroot00000000000000# unicode-match-property-ecmascript [![Build status](https://travis-ci.org/mathiasbynens/unicode-match-property-ecmascript.svg?branch=master)](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 | [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](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. unicode-match-property-ecmascript-1.0.4/index.js000077500000000000000000000007011330622731400217150ustar00rootroot00000000000000'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; unicode-match-property-ecmascript-1.0.4/package.json000066400000000000000000000020711330622731400225350ustar00rootroot00000000000000{ "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" } } unicode-match-property-ecmascript-1.0.4/tests/000077500000000000000000000000001330622731400214115ustar00rootroot00000000000000unicode-match-property-ecmascript-1.0.4/tests/tests.js000066400000000000000000000044101330622731400231100ustar00rootroot00000000000000import test from 'ava'; import matchProperty from '../index.js'; test(t => { t.deepEqual( matchProperty('gc'), 'General_Category' ); t.deepEqual( matchProperty('General_Category'), 'General_Category' ); t.deepEqual( matchProperty('sc'), 'Script' ); t.deepEqual( matchProperty('Script'), 'Script' ); t.deepEqual( matchProperty('scx'), 'Script_Extensions' ); t.deepEqual( matchProperty('Script_Extensions'), 'Script_Extensions' ); t.throws( () => matchProperty('Script Extensions'), Error ); t.deepEqual( matchProperty('ASCII'), 'ASCII' ); t.deepEqual( matchProperty('Any'), 'Any' ); t.deepEqual( matchProperty('Assigned'), 'Assigned' ); t.deepEqual( matchProperty('AHex'), 'ASCII_Hex_Digit' ); t.deepEqual( matchProperty('Emoji_Modifier'), 'Emoji_Modifier' ); t.throws( () => matchProperty('emojimodifier'), Error ); t.deepEqual( matchProperty('Emoji_Component'), 'Emoji_Component' ); t.throws( () => matchProperty('emojicomponent'), Error ); t.throws( () => matchProperty('Composition_Exclusion'), Error ); t.throws( () => matchProperty('Expands_On_NFC'), Error ); t.throws( () => matchProperty('Expands_On_NFD'), Error ); t.throws( () => matchProperty('Expands_On_NFKC'), Error ); t.throws( () => matchProperty('Expands_On_NFKD'), Error ); t.throws( () => matchProperty('FC_NFKC_Closure'), Error ); t.throws( () => matchProperty('Full_Composition_Exclusion'), Error ); t.throws( () => matchProperty('Grapheme_Link'), Error ); t.throws( () => matchProperty('Hyphen'), Error ); t.throws( () => matchProperty('Other_Alphabetic'), Error ); t.throws( () => matchProperty('Other_Default_Ignorable_Code_Point'), Error ); t.throws( () => matchProperty('Other_Grapheme_Extend'), Error ); t.throws( () => matchProperty('Other_ID_Continue'), Error ); t.throws( () => matchProperty('Other_ID_Start'), Error ); t.throws( () => matchProperty('Other_Lowercase'), Error ); t.throws( () => matchProperty('Other_Math'), Error ); t.throws( () => matchProperty('Other_Uppercase'), Error ); t.throws( () => matchProperty('Prepended_Concatenation_Mark'), Error ); t.throws( () => matchProperty('unknown property'), Error ); });