Converts character or string to Hex Unicode
NodeJS developer dependencies may be installed via NPM...
npm install
Note, NPM is not required to utilize this project, only for tracking development dependencies.
For use with GitHub Pages, this repository encourages the use of Git Submodules to track dependencies
Bash Variables
_module_name='to-unicode'
_module_https_url="https://github.com/javascript-utilities/to-unicode.git"
_module_base_dir='assets/javascript/modules'
_module_path="${_module_base_dir}/${_module_name}"
Bash Submodule Commands
cd "<your-git-project-path>"
git checkout gh-pages
mkdir -vp "${_module_base_dir}"
git submodule add -b main\
--name "${_module_name}"\
"${_module_https_url}"\
"${_module_path}"
Suggested additions for your ReadMe.md
file so everyone has a good time with submodules
Clone with the following to avoid incomplete downloads
git clone --recurse-submodules <url-for-your-project>
Update/upgrade submodules via
git submodule update --init --merge --recursive
git add .gitmodules
git add "${_module_path}"
## Add any changed files too
git commit -F- <<'EOF'
:heavy_plus_sign: Adds `javascript-utilities/to-unicode#1` submodule
**Additions**
- `.gitmodules`, tracks submodules AKA Git within Git _fanciness_
- `README.md`, updates installation and updating guidance
- `_modules_/to-unicode`, Converts character or string to Hex Unicode
EOF
git push origin gh-pages
π Excellent π your project is now ready to begin unitizing code from this repository!
This project is compatible with NodeJS and most browsers that support ECMAScript (version 6 or greater)
NodeJS example usage...
const toUnicode = require('to-unicode');
var panda_code = toUnicode.fromCharacter('πΌ');
console.log(panda_code);
//> '1f43c'
Example usage within a web project...
index.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>toUnicode Usage Example</title>
<script type="text/javascript" src="assets/js/modules/to-unicode.js" differ></script>
<script type="text/javascript" src="assets/js/index.js" differ></script>
</head>
<body>
<span>Prefix: </span>
<input type="text" id="client__text--prefix" value="0x">
<br>
<span>Input: </span>
<input type="text" id="client__text--input" value="">
<pre id="client__text--output"></pre>
</body>
</html>
assets/js/index.js
const text_input__callback = (_event) => {
const client_input = document.getElementById('client__text--input').value;
const client_prefix = document.getElementById('client__text--prefix').value;
const output_element = document.getElementById('client__text--output');
const unicode_list = toUnicode.fromString(client_input, client_prefix);
console.log(unicode_list);
output_element.innerText = unicode_list.join('\n');
};
window.addEventListener('load', () => {
const client_text_input = document.getElementById('client__text--input');
const client_text_prefix = document.getElementById('client__text--prefix');
client_text_input.addEventListener('input', text_input__callback);
client_text_prefix.addEventListener('input', text_input__callback);
});
This repository may not be feature complete and/or fully functional, Pull Requests that add features or fix bugs are certainly welcomed.
-
Fork this repository to an account that you have write permissions for.
-
Add remote for fork URL. The URL syntax is
[email protected]:<NAME>/<REPO>.git
...
cd ~/git/hub/javascript-utilities/to-unicode
git remote add fork [email protected]:<NAME>/to-unicode.git
- Commit your changes and push to your fork, eg. to fix an issue...
cd ~/git/hub/javascript-utilities/to-unicode
git commit -F- <<'EOF'
:bug: Fixes #42 Issue
**Edits**
- `<SCRIPT-NAME>` script, fixes some bug reported in issue
EOF
git push fork main
Note, the
-u
option may be used to setfork
as the default remote, eg.git push fork main
however, this will also default thefork
remote for pulling from too! Meaning that pulling updates fromorigin
must be done explicitly, eg.git pull origin main
- Then on GitHub submit a Pull Request through the Web-UI, the URL syntax is
https://github.com/<NAME>/<REPO>/pull/new/<BRANCH>
Note; to decrease the chances of your Pull Request needing modifications before being accepted, please check the dot-github repository for detailed contributing guidelines.
Converts character or string to Hex Unicode
Copyright (C) 2020 S0AndS0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For further details review full length version of AGPL-3.0 License.