JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10733
  • Score
    100M100P100Q146036F

Get a UTF-16-encoded code point number of a character

Package Exports

  • code-point

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (code-point) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

code-point.js

Build Status Build status Coverage Status devDependency Status

Get a UTF-16-encoded code point number of a character

codePoint('A'); //=> 65
'A'.charCodeAt(0); //=> 65

codePoint('嶲'); //=> 195060
'嶲'.charCodeAt(0); //=> 55422

Installation

Package managers

npm NPM version

npm i --save code-point

Bower Bower version

bower i --save code-point

Duo

var codePoint = require('shinnn/code-point.js');

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.

codePoint('\udada'); //=> 56026
codePoint('\udada\udfdf'); //=> 814047

It works even if the String object doesn't have codePointAt method as its prototype.

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 Shinnosuke Watanabe

Licensed under the MIT License.