code-point.js
Get a UTF-16-encoded code point number of a character
'A'; //=> 65; //=> 65 '嶲'; //=> 55422; //=> 195060
Installation
Package managers
npm
npm install code-point
Bower
bower install code-point
Standalone
Download the script file directly.
API
codePoint(character)
character: String
Return: Number
If it takes a string as an argument, it returns the same result of character.codePointAt(0)
.
It throws an error if the argument is not a string or the string is empty.
; //=> 56026; //=> 814047
It works correctly even in ECMAScript <= 5 environments that don't support String.prototype.codePointAt
.
Credit
This module includes the code of mathiasbynens / String.prototype.codePointAt. Thanks, Mathias Bynens.
Licenses
String.prototype.codePointAt
Author: Mathias Bynens
This polyfill is available under the MIT license.
code-point.js
Copyright (c) 2014 - 2016 Shinnosuke Watanabe
Licensed under the MIT License.