code-point
Get a UTF-16-encoded code point number of a character
Last updated 12 years ago by shinnn .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install code-point 
SYNC missed versions from official npm registry.

code-point.js

NPM version Bower version Build Status Coverage Status devDependency Status

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

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

'????'.charCodeAt(0); //=> 55422
codePoint('????'); //=> 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.

codePoint('\udada'); //=> 56026
codePoint('\udada\udfdf'); //=> 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.

Current Tags

  • 1.1.0                                ...           latest (10 years ago)
  • 2.0.0-1                                ...           next (7 years ago)

7 Versions

  • 2.0.0-1                                ...           7 years ago
  • 2.0.0-0                                ...           7 years ago
  • 1.1.0                                ...           10 years ago
  • 1.0.1                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
  • 0.0.1                                ...           12 years ago
  • 0.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (17)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |