[Pkg-javascript-commits] [node-unicode-property-aliases] 01/03: New upstream version 1.1.1

Julien Puydt julien.puydt at laposte.net
Wed Sep 6 07:26:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-unicode-property-aliases.

commit 500b22de7d7370d861930cd678a3c6b7092f6f9c
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Thu Aug 24 16:50:54 2017 +0200

    New upstream version 1.1.1
---
 .editorconfig            |  12 +++
 .gitattributes           |   1 +
 .gitignore               |  14 ++++
 .travis.yml              |   4 +
 LICENSE-MIT.txt          |  20 +++++
 README.md                |  38 +++++++++
 data/PropertyAliases.txt | 195 +++++++++++++++++++++++++++++++++++++++++++++++
 index.js                 | 125 ++++++++++++++++++++++++++++++
 package.json             |  40 ++++++++++
 scripts/build.js         |  36 +++++++++
 tests/tests.js           |  33 ++++++++
 11 files changed, 518 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..dbd9e6b
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+root = 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
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..176a458
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ca85bae
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+# Installed npm modules
+node_modules
+
+# Folder view configuration files
+.DS_Store
+Desktop.ini
+
+# Thumbnail cache files
+._*
+Thumbs.db
+
+# Files that might appear on external disks
+.Spotlight-V100
+.Trashes
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..52ad81f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+  - "6"
+  - "4"
diff --git a/LICENSE-MIT.txt b/LICENSE-MIT.txt
new file mode 100644
index 0000000..a41e0a7
--- /dev/null
+++ b/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/README.md b/README.md
new file mode 100644
index 0000000..a9db45b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,38 @@
+# unicode-property-aliases [![Build status](https://travis-ci.org/mathiasbynens/unicode-property-aliases.svg?branch=master)](https://travis-ci.org/mathiasbynens/unicode-property-aliases)
+
+_unicode-property-aliases_ offers the Unicode property alias mappings in an easy-to-consume JavaScript format.
+
+It’s based on [the `PropertyAliases.txt` data for Unicode v9.0.0](http://unicode.org/Public/9.0.0/ucd/PropertyAliases.txt).
+
+## Installation
+
+To use _unicode-property-aliases_ programmatically, install it as a dependency via [npm](https://www.npmjs.com/):
+
+```bash
+$ npm install unicode-property-aliases
+```
+
+Then, `require` it:
+
+```js
+const propertyAliases = require('unicode-property-aliases');
+```
+
+## Usage
+
+This module exports a `Map` object. The most common usage is to convert a property alias to its canonical form:
+
+```js
+propertyAliases.get('sfc')
+// → 'Simple_Case_Folding'
+```
+
+## 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-property-aliases_ is available under the [MIT](https://mths.be/mit) license.
diff --git a/data/PropertyAliases.txt b/data/PropertyAliases.txt
new file mode 100644
index 0000000..5284682
--- /dev/null
+++ b/data/PropertyAliases.txt
@@ -0,0 +1,195 @@
+# PropertyAliases-9.0.0.txt
+# Date: 2016-03-02, 18:55:05 GMT
+# © 2016 Unicode®, Inc.
+# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
+# For terms of use, see http://www.unicode.org/terms_of_use.html
+#
+# Unicode Character Database
+#   For documentation, see http://www.unicode.org/reports/tr44/
+#
+# This file contains aliases for properties used in the UCD.
+# These names can be used for XML formats of UCD data, for regular-expression
+# property tests, and other programmatic textual descriptions of Unicode data.
+#
+# The names may be translated in appropriate environments, and additional
+# aliases may be useful.
+#
+# FORMAT
+#
+# Each line has two or more fields, separated by semicolons.
+#
+# First Field: The first field is an abbreviated name for the property.
+#
+# Second Field: The second field is a long name
+#
+# The above are the preferred aliases. Other aliases may be listed in additional fields.
+#
+# Loose matching should be applied to all property names and property values, with
+# the exception of String Property values. With loose matching of property names and
+# values, the case distinctions, whitespace, and '_' are ignored. For Numeric Property
+# values, numeric equivalencies are applied: thus "01.00" is equivalent to "1".
+#
+# NOTE: Property value names are NOT unique across properties. For example:
+#
+#   AL means Arabic Letter for the Bidi_Class property, and
+#   AL means Above_Left for the Combining_Class property, and
+#   AL means Alphabetic for the Line_Break property.
+#
+# In addition, some property names may be the same as some property value names.
+# For example:
+#
+#   sc means the Script property, and
+#   Sc means the General_Category property value Currency_Symbol (Sc)
+#
+# The combination of property value and property name is, however, unique.
+#
+# For more information, see UTS #18: Unicode Regular Expressions
+# ================================================
+
+
+# ================================================
+# Numeric Properties
+# ================================================
+cjkAccountingNumeric     ; kAccountingNumeric
+cjkOtherNumeric          ; kOtherNumeric
+cjkPrimaryNumeric        ; kPrimaryNumeric
+nv                       ; Numeric_Value
+
+# ================================================
+# String Properties
+# ================================================
+cf                       ; Case_Folding
+cjkCompatibilityVariant  ; kCompatibilityVariant
+dm                       ; Decomposition_Mapping
+FC_NFKC                  ; FC_NFKC_Closure
+lc                       ; Lowercase_Mapping
+NFKC_CF                  ; NFKC_Casefold
+scf                      ; Simple_Case_Folding         ; sfc
+slc                      ; Simple_Lowercase_Mapping
+stc                      ; Simple_Titlecase_Mapping
+suc                      ; Simple_Uppercase_Mapping
+tc                       ; Titlecase_Mapping
+uc                       ; Uppercase_Mapping
+
+# ================================================
+# Miscellaneous Properties
+# ================================================
+bmg                      ; Bidi_Mirroring_Glyph
+bpb                      ; Bidi_Paired_Bracket
+cjkIICore                ; kIICore
+cjkIRG_GSource           ; kIRG_GSource
+cjkIRG_HSource           ; kIRG_HSource
+cjkIRG_JSource           ; kIRG_JSource
+cjkIRG_KPSource          ; kIRG_KPSource
+cjkIRG_KSource           ; kIRG_KSource
+cjkIRG_MSource           ; kIRG_MSource
+cjkIRG_TSource           ; kIRG_TSource
+cjkIRG_USource           ; kIRG_USource
+cjkIRG_VSource           ; kIRG_VSource
+cjkRSUnicode             ; kRSUnicode                  ; Unicode_Radical_Stroke; URS
+isc                      ; ISO_Comment
+JSN                      ; Jamo_Short_Name
+na                       ; Name
+na1                      ; Unicode_1_Name
+Name_Alias               ; Name_Alias
+scx                      ; Script_Extensions
+
+# ================================================
+# Catalog Properties
+# ================================================
+age                      ; Age
+blk                      ; Block
+sc                       ; Script
+
+# ================================================
+# Enumerated Properties
+# ================================================
+bc                       ; Bidi_Class
+bpt                      ; Bidi_Paired_Bracket_Type
+ccc                      ; Canonical_Combining_Class
+dt                       ; Decomposition_Type
+ea                       ; East_Asian_Width
+gc                       ; General_Category
+GCB                      ; Grapheme_Cluster_Break
+hst                      ; Hangul_Syllable_Type
+InPC                     ; Indic_Positional_Category
+InSC                     ; Indic_Syllabic_Category
+jg                       ; Joining_Group
+jt                       ; Joining_Type
+lb                       ; Line_Break
+NFC_QC                   ; NFC_Quick_Check
+NFD_QC                   ; NFD_Quick_Check
+NFKC_QC                  ; NFKC_Quick_Check
+NFKD_QC                  ; NFKD_Quick_Check
+nt                       ; Numeric_Type
+SB                       ; Sentence_Break
+WB                       ; Word_Break
+
+# ================================================
+# Binary Properties
+# ================================================
+AHex                     ; ASCII_Hex_Digit
+Alpha                    ; Alphabetic
+Bidi_C                   ; Bidi_Control
+Bidi_M                   ; Bidi_Mirrored
+Cased                    ; Cased
+CE                       ; Composition_Exclusion
+CI                       ; Case_Ignorable
+Comp_Ex                  ; Full_Composition_Exclusion
+CWCF                     ; Changes_When_Casefolded
+CWCM                     ; Changes_When_Casemapped
+CWKCF                    ; Changes_When_NFKC_Casefolded
+CWL                      ; Changes_When_Lowercased
+CWT                      ; Changes_When_Titlecased
+CWU                      ; Changes_When_Uppercased
+Dash                     ; Dash
+Dep                      ; Deprecated
+DI                       ; Default_Ignorable_Code_Point
+Dia                      ; Diacritic
+Ext                      ; Extender
+Gr_Base                  ; Grapheme_Base
+Gr_Ext                   ; Grapheme_Extend
+Gr_Link                  ; Grapheme_Link
+Hex                      ; Hex_Digit
+Hyphen                   ; Hyphen
+IDC                      ; ID_Continue
+Ideo                     ; Ideographic
+IDS                      ; ID_Start
+IDSB                     ; IDS_Binary_Operator
+IDST                     ; IDS_Trinary_Operator
+Join_C                   ; Join_Control
+LOE                      ; Logical_Order_Exception
+Lower                    ; Lowercase
+Math                     ; Math
+NChar                    ; Noncharacter_Code_Point
+OAlpha                   ; Other_Alphabetic
+ODI                      ; Other_Default_Ignorable_Code_Point
+OGr_Ext                  ; Other_Grapheme_Extend
+OIDC                     ; Other_ID_Continue
+OIDS                     ; Other_ID_Start
+OLower                   ; Other_Lowercase
+OMath                    ; Other_Math
+OUpper                   ; Other_Uppercase
+Pat_Syn                  ; Pattern_Syntax
+Pat_WS                   ; Pattern_White_Space
+PCM                      ; Prepended_Concatenation_Mark
+QMark                    ; Quotation_Mark
+Radical                  ; Radical
+SD                       ; Soft_Dotted
+STerm                    ; Sentence_Terminal
+Term                     ; Terminal_Punctuation
+UIdeo                    ; Unified_Ideograph
+Upper                    ; Uppercase
+VS                       ; Variation_Selector
+WSpace                   ; White_Space                 ; space
+XIDC                     ; XID_Continue
+XIDS                     ; XID_Start
+XO_NFC                   ; Expands_On_NFC
+XO_NFD                   ; Expands_On_NFD
+XO_NFKC                  ; Expands_On_NFKC
+XO_NFKD                  ; Expands_On_NFKD
+
+# ================================================
+# Total:    118
+
+# EOF
diff --git a/index.js b/index.js
new file mode 100755
index 0000000..32229b0
--- /dev/null
+++ b/index.js
@@ -0,0 +1,125 @@
+// Generated using `npm run build`. Do not edit!
+module.exports = new Map([
+	['cjkAccountingNumeric', 'kAccountingNumeric'],
+	['cjkOtherNumeric', 'kOtherNumeric'],
+	['cjkPrimaryNumeric', 'kPrimaryNumeric'],
+	['nv', 'Numeric_Value'],
+	['cf', 'Case_Folding'],
+	['cjkCompatibilityVariant', 'kCompatibilityVariant'],
+	['dm', 'Decomposition_Mapping'],
+	['FC_NFKC', 'FC_NFKC_Closure'],
+	['lc', 'Lowercase_Mapping'],
+	['NFKC_CF', 'NFKC_Casefold'],
+	['scf', 'Simple_Case_Folding'],
+	['sfc', 'Simple_Case_Folding'],
+	['slc', 'Simple_Lowercase_Mapping'],
+	['stc', 'Simple_Titlecase_Mapping'],
+	['suc', 'Simple_Uppercase_Mapping'],
+	['tc', 'Titlecase_Mapping'],
+	['uc', 'Uppercase_Mapping'],
+	['bmg', 'Bidi_Mirroring_Glyph'],
+	['bpb', 'Bidi_Paired_Bracket'],
+	['cjkIICore', 'kIICore'],
+	['cjkIRG_GSource', 'kIRG_GSource'],
+	['cjkIRG_HSource', 'kIRG_HSource'],
+	['cjkIRG_JSource', 'kIRG_JSource'],
+	['cjkIRG_KPSource', 'kIRG_KPSource'],
+	['cjkIRG_KSource', 'kIRG_KSource'],
+	['cjkIRG_MSource', 'kIRG_MSource'],
+	['cjkIRG_TSource', 'kIRG_TSource'],
+	['cjkIRG_USource', 'kIRG_USource'],
+	['cjkIRG_VSource', 'kIRG_VSource'],
+	['cjkRSUnicode', 'kRSUnicode'],
+	['Unicode_Radical_Stroke', 'kRSUnicode'],
+	['URS', 'kRSUnicode'],
+	['isc', 'ISO_Comment'],
+	['JSN', 'Jamo_Short_Name'],
+	['na', 'Name'],
+	['na1', 'Unicode_1_Name'],
+	['Name_Alias', 'Name_Alias'],
+	['scx', 'Script_Extensions'],
+	['age', 'Age'],
+	['blk', 'Block'],
+	['sc', 'Script'],
+	['bc', 'Bidi_Class'],
+	['bpt', 'Bidi_Paired_Bracket_Type'],
+	['ccc', 'Canonical_Combining_Class'],
+	['dt', 'Decomposition_Type'],
+	['ea', 'East_Asian_Width'],
+	['gc', 'General_Category'],
+	['GCB', 'Grapheme_Cluster_Break'],
+	['hst', 'Hangul_Syllable_Type'],
+	['InPC', 'Indic_Positional_Category'],
+	['InSC', 'Indic_Syllabic_Category'],
+	['jg', 'Joining_Group'],
+	['jt', 'Joining_Type'],
+	['lb', 'Line_Break'],
+	['NFC_QC', 'NFC_Quick_Check'],
+	['NFD_QC', 'NFD_Quick_Check'],
+	['NFKC_QC', 'NFKC_Quick_Check'],
+	['NFKD_QC', 'NFKD_Quick_Check'],
+	['nt', 'Numeric_Type'],
+	['SB', 'Sentence_Break'],
+	['WB', 'Word_Break'],
+	['AHex', 'ASCII_Hex_Digit'],
+	['Alpha', 'Alphabetic'],
+	['Bidi_C', 'Bidi_Control'],
+	['Bidi_M', 'Bidi_Mirrored'],
+	['Cased', 'Cased'],
+	['CE', 'Composition_Exclusion'],
+	['CI', 'Case_Ignorable'],
+	['Comp_Ex', 'Full_Composition_Exclusion'],
+	['CWCF', 'Changes_When_Casefolded'],
+	['CWCM', 'Changes_When_Casemapped'],
+	['CWKCF', 'Changes_When_NFKC_Casefolded'],
+	['CWL', 'Changes_When_Lowercased'],
+	['CWT', 'Changes_When_Titlecased'],
+	['CWU', 'Changes_When_Uppercased'],
+	['Dash', 'Dash'],
+	['Dep', 'Deprecated'],
+	['DI', 'Default_Ignorable_Code_Point'],
+	['Dia', 'Diacritic'],
+	['Ext', 'Extender'],
+	['Gr_Base', 'Grapheme_Base'],
+	['Gr_Ext', 'Grapheme_Extend'],
+	['Gr_Link', 'Grapheme_Link'],
+	['Hex', 'Hex_Digit'],
+	['Hyphen', 'Hyphen'],
+	['IDC', 'ID_Continue'],
+	['Ideo', 'Ideographic'],
+	['IDS', 'ID_Start'],
+	['IDSB', 'IDS_Binary_Operator'],
+	['IDST', 'IDS_Trinary_Operator'],
+	['Join_C', 'Join_Control'],
+	['LOE', 'Logical_Order_Exception'],
+	['Lower', 'Lowercase'],
+	['Math', 'Math'],
+	['NChar', 'Noncharacter_Code_Point'],
+	['OAlpha', 'Other_Alphabetic'],
+	['ODI', 'Other_Default_Ignorable_Code_Point'],
+	['OGr_Ext', 'Other_Grapheme_Extend'],
+	['OIDC', 'Other_ID_Continue'],
+	['OIDS', 'Other_ID_Start'],
+	['OLower', 'Other_Lowercase'],
+	['OMath', 'Other_Math'],
+	['OUpper', 'Other_Uppercase'],
+	['Pat_Syn', 'Pattern_Syntax'],
+	['Pat_WS', 'Pattern_White_Space'],
+	['PCM', 'Prepended_Concatenation_Mark'],
+	['QMark', 'Quotation_Mark'],
+	['Radical', 'Radical'],
+	['SD', 'Soft_Dotted'],
+	['STerm', 'Sentence_Terminal'],
+	['Term', 'Terminal_Punctuation'],
+	['UIdeo', 'Unified_Ideograph'],
+	['Upper', 'Uppercase'],
+	['VS', 'Variation_Selector'],
+	['WSpace', 'White_Space'],
+	['space', 'White_Space'],
+	['XIDC', 'XID_Continue'],
+	['XIDS', 'XID_Start'],
+	['XO_NFC', 'Expands_On_NFC'],
+	['XO_NFD', 'Expands_On_NFD'],
+	['XO_NFKC', 'Expands_On_NFKC'],
+	['XO_NFKD', 'Expands_On_NFKD']
+]);
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..285a0ca
--- /dev/null
+++ b/package.json
@@ -0,0 +1,40 @@
+{
+  "name": "unicode-property-aliases",
+  "version": "1.1.1",
+  "description": "Unicode property alias mappings in JavaScript format.",
+  "homepage": "https://github.com/mathiasbynens/unicode-property-aliases",
+  "main": "index.js",
+  "engines": {
+    "node": ">=4"
+  },
+  "files": [
+    "LICENSE-MIT.txt",
+    "index.js"
+  ],
+  "keywords": [
+    "unicode",
+    "unicode-data",
+    "alias",
+    "aliases",
+    "property alias"
+  ],
+  "license": "MIT",
+  "author": {
+    "name": "Mathias Bynens",
+    "url": "https://mathiasbynens.be/"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/mathiasbynens/unicode-property-aliases.git"
+  },
+  "bugs": "https://github.com/mathiasbynens/unicode-property-aliases/issues",
+  "devDependencies": {
+    "ava": "*",
+    "jsesc": "^2.0.0"
+  },
+  "scripts": {
+    "download": "curl http://unicode.org/Public/9.0.0/ucd/PropertyAliases.txt > data/PropertyAliases.txt",
+    "build": "node scripts/build.js",
+    "test": "ava ./tests"
+  }
+}
diff --git a/scripts/build.js b/scripts/build.js
new file mode 100644
index 0000000..43748cf
--- /dev/null
+++ b/scripts/build.js
@@ -0,0 +1,36 @@
+'use strict';
+
+const fs = require('fs');
+const jsesc = require('jsesc');
+
+const parsePropertyAliases = function() {
+	const map = new Map();
+	const source = fs.readFileSync('./data/PropertyAliases.txt', 'utf8');
+	const lines = source.split('\n');
+	lines.forEach(function(line) {
+		if (!line || /^#/.test(line)) {
+			return;
+		}
+		const data = line.trim().split(';');
+		const alias1 = data[0].trim();
+		const canonicalName = data[1].trim();
+		console.assert(!map.has(alias1));
+		map.set(alias1, canonicalName);
+		const remaining = data.slice(2);
+		for (const otherAliasData of remaining) {
+			const otherAlias = otherAliasData.trim();
+			console.assert(!map.has(otherAlias));
+			map.set(otherAlias, canonicalName);
+		}
+	});
+	return map;
+};
+
+const map = parsePropertyAliases();
+const header = '// Generated using `npm run build`. Do not edit!';
+const output = `${ header }\nmodule.exports = ${
+	jsesc(map, {
+		'compact': false
+	})
+};\n`;
+require('fs').writeFileSync('./index.js', output);
diff --git a/tests/tests.js b/tests/tests.js
new file mode 100644
index 0000000..20884d4
--- /dev/null
+++ b/tests/tests.js
@@ -0,0 +1,33 @@
+import test from 'ava';
+import propertyAliases from '../index.js';
+
+test(t => {
+	t.is(
+		propertyAliases.get('scf'),
+		'Simple_Case_Folding'
+	);
+	t.is(
+		propertyAliases.get('sfc'),
+		'Simple_Case_Folding'
+	);
+	t.is(
+		propertyAliases.get('cjkRSUnicode'),
+		'kRSUnicode'
+	);
+	t.is(
+		propertyAliases.get('Unicode_Radical_Stroke'),
+		'kRSUnicode'
+	);
+	t.is(
+		propertyAliases.get('URS'),
+		'kRSUnicode'
+	);
+	t.is(
+		propertyAliases.get('WSpace'),
+		'White_Space'
+	);
+	t.is(
+		propertyAliases.get('space'),
+		'White_Space'
+	);
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-unicode-property-aliases.git



More information about the Pkg-javascript-commits mailing list