unicode-tr51-9.0.0/000077500000000000000000000000001314525444600137475ustar00rootroot00000000000000unicode-tr51-9.0.0/.gitattributes000066400000000000000000000001141314525444600166360ustar00rootroot00000000000000# Automatically normalize line endings for all text-based files * text=auto unicode-tr51-9.0.0/.gitignore000066400000000000000000000003471314525444600157430ustar00rootroot00000000000000# Coverage report coverage # 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 unicode-tr51-9.0.0/.travis.yml000066400000000000000000000005621314525444600160630ustar00rootroot00000000000000sudo: false language: node_js node_js: - '6' - '7' script: - 'if [ "${TRAVIS_NODE_VERSION}" = "7" ]; then npm run build; fi' - 'npm test' after_script: - 'istanbul cover --verbose --dir coverage node_modules/.bin/_mocha scripts/parse-emoji-data.js -- -u exports -R spec && cat coverage/lcov.info | coveralls; rm -rf coverage/lcov*' git: depth: 1 unicode-tr51-9.0.0/LICENSE-MIT.txt000066400000000000000000000020651314525444600162240ustar00rootroot00000000000000Copyright 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-tr51-9.0.0/README.md000066400000000000000000000037351314525444600152360ustar00rootroot00000000000000# unicode-tr51 [![Build status](https://travis-ci.org/mathiasbynens/unicode-tr51.svg?branch=master)](https://travis-ci.org/mathiasbynens/unicode-tr51) [![Code coverage status](http://img.shields.io/coveralls/mathiasbynens/unicode-tr51/master.svg)](https://coveralls.io/r/mathiasbynens/unicode-tr51) [![Dependency status](https://gemnasium.com/mathiasbynens/unicode-tr51.svg)](https://gemnasium.com/mathiasbynens/unicode-tr51) _unicode-tr51_ contains data extracted from [the `emoji-data.txt` file](http://unicode.org/Public/emoji/latest/emoji-data.txt) that is part of [Unicode Technical Report #51](http://unicode.org/reports/tr51/). This package enables an easy way of getting the list of all emoji code points in your JavaScript build scripts. ## Installation Via [npm](https://www.npmjs.com/): ```bash npm install unicode-tr51 ``` In [Node.js](https://nodejs.org/): ```js const properties = require('unicode-tr51'); // → [ 'Emoji', 'Emoji_Component', Emoji_Modifier', 'Emoji_Modifier_Base', 'Emoji_Presentation' ] const Emoji = require('unicode-tr51/Emoji.js'); const Emoji_Component = require('unicode-tr51/Emoji_Component.js'); const Emoji_Modifier = require('unicode-tr51/Emoji_Modifier.js'); const Emoji_Modifier_Base = require('unicode-tr51/Emoji_Modifier_Base.js'); const Emoji_Presentation = require('unicode-tr51/Emoji_Presentation.js'); // A list of all emoji sequences is available as an array of strings: const sequences = require('unicode-tr51/sequences.js'); // Note that the sequence properties (e.g. `Emoji_Flag_Sequence`) aren’t (yet) exposed individually. ``` To get the UTR51 version the data was based on: ```js const version = require('unicode-tr51/emoji-version.js'); ``` ## 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-tr51_ is available under the [MIT](https://mths.be/mit) license. unicode-tr51-9.0.0/package.json000066400000000000000000000030701314525444600162350ustar00rootroot00000000000000{ "name": "unicode-tr51", "version": "9.0.0", "description": "Emoji data extracted from Unicode Technical Report #51.", "homepage": "https://mths.be/unicode-tr51", "main": "symbols.js", "keywords": [ "unicode", "unicode-data", "code points", "symbols", "characters", "emoji", "data" ], "license": "MIT", "author": { "name": "Mathias Bynens", "url": "https://mathiasbynens.be/" }, "repository": { "type": "git", "url": "https://github.com/mathiasbynens/unicode-tr51.git" }, "bugs": "https://github.com/mathiasbynens/unicode-tr51/issues", "files": [ "LICENSE-MIT.txt", "index.js", "emoji-version.js", "Emoji.js", "Emoji_Component.js", "Emoji_Modifier.js", "Emoji_Modifier_Base.js", "Emoji_Presentation.js", "Extended_Pictographic.js", "sequences.js" ], "directories": { "test": "tests" }, "scripts": { "download": "curl -L http://unicode.org/Public/emoji/6.0/emoji-data.txt > data/emoji-data.txt && curl -L http://unicode.org/Public/emoji/6.0/emoji-sequences.txt > data/emoji-sequences.txt && curl -L http://unicode.org/Public/emoji/6.0/emoji-zwj-sequences.txt > data/emoji-zwj-sequences.txt", "build": "node scripts/parse-emoji-data.js && node scripts/parse-emoji-sequences.js", "coverage": "istanbul cover --report html node_modules/.bin/_mocha scripts/parse-emoji-data.js -- -u exports -R spec", "test": "mocha tests" }, "devDependencies": { "coveralls": "^2.11.1", "istanbul": "^0.4.5", "jsesc": "^2.2.0", "mocha": "^3.1.2" } } unicode-tr51-9.0.0/scripts/000077500000000000000000000000001314525444600154365ustar00rootroot00000000000000unicode-tr51-9.0.0/scripts/parse-emoji-data.js000066400000000000000000000033131314525444600211160ustar00rootroot00000000000000'use strict'; const fs = require('fs'); const jsesc = require('jsesc'); const range = function(start, stop) { // inclusive, e.g. `range(1, 3)` → `[1, 2, 3]` const result = []; for (; start <= stop; result.push(start++)); return result; }; const append = function(map, key, value) { if (map.has(key)) { map.get(key).push(value); } else { map.set(key, [value]); } }; const parseEmojiData = function() { const map = new Map(); const source = fs.readFileSync('data/emoji-data.txt', 'utf8'); if (!source) { return; } const lines = source.split('\n'); for (const line of lines) { if (!line || /^#/.test(line)) { continue; } const data = line.trim().split(';'); const charRange = data[0].replace('..', '-').trim(); const rangeParts = charRange.split('-'); const value = data[1].split('#')[0].trim(); if (rangeParts.length == 2) { range( parseInt(rangeParts[0], 16), parseInt(rangeParts[1], 16) ).forEach(function(codePoint) { append(map, value, codePoint); }); } else { const codePoint = parseInt(charRange, 16); append(map, value, codePoint); } } return map; }; const map = parseEmojiData(); const writeData = function(fileName, data) { fs.writeFileSync( fileName, `module.exports = ` + jsesc(data, { 'compact': false, 'numbers': 'hexadecimal', 'wrap': true }) + `;\n` ); }; for (const [propertyName, codePoints] of map.entries()) { writeData(`./${ propertyName }.js`, codePoints); } const properties = [...map.keys()]; writeData('./index.js', properties); const downloadCommand = require('../package.json').scripts.download; const version = downloadCommand.match(/\/emoji\/([^\/]+)\/emoji-data.txt/)[1]; writeData('./emoji-version.js', version); unicode-tr51-9.0.0/scripts/parse-emoji-sequences.js000066400000000000000000000017041314525444600222020ustar00rootroot00000000000000'use strict'; const fs = require('fs'); const jsesc = require('jsesc'); const parseEmojiSequences = function(fileName) { const sequences = []; const source = fs.readFileSync(fileName, 'utf8'); if (!source) { return; } const lines = source.split('\n'); for (const line of lines) { if (!line || /^#/.test(line)) { continue; } const data = line.trim().split(';'); const sequence = data[0].trim(); const parts = sequence.split(' ').map(part => { const codePoint = parseInt(part.trim(), 16); return String.fromCodePoint(codePoint); }); sequences.push(parts.join('')); } return sequences; }; const sequences = parseEmojiSequences('data/emoji-sequences.txt') .concat(parseEmojiSequences('data/emoji-zwj-sequences.txt')); const writeData = function(fileName, data) { fs.writeFileSync( fileName, `module.exports = ` + jsesc(data, { 'compact': false, 'es6': false }) + `;\n` ); }; writeData(`./sequences.js`, sequences); unicode-tr51-9.0.0/tests/000077500000000000000000000000001314525444600151115ustar00rootroot00000000000000unicode-tr51-9.0.0/tests/tests.js000066400000000000000000000015141314525444600166120ustar00rootroot00000000000000const assert = require('assert'); const Emoji = require('../Emoji.js'); const Emoji_Modifier = require('../Emoji_Modifier.js'); const Emoji_Modifier_Base = require('../Emoji_Modifier_Base.js'); const Emoji_Presentation = require('../Emoji_Presentation.js'); const sequences = require('../sequences.js'); describe('Emoji data', function() { it('contains expected code points', function() { assert(Emoji.includes(0x1F198)); assert(Emoji.includes(0x1F9DD)); assert(Emoji_Modifier.includes(0x1F3FD)); assert(Emoji_Modifier_Base.includes(0x1F3C3)); assert(Emoji_Presentation.includes(0x1F367)); // Test a regular sequence (`emoji-sequences.txt`). assert(sequences.includes('\u{1F9DC}\u{1F3FB}')); // Test a ZWJ sequence (`emoji-zwj-sequences.txt`). assert(sequences.includes('\u{1F3CA}\u{1F3FD}\u200D\u2640\uFE0F')); }); });