JSPM

is-4byte-char

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1243
  • Score
    100M100P100Q120342F
  • License MIT

Check if a given value is a character that costs 4 bytes in UTF-8

Package Exports

  • is-4byte-char

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 (is-4byte-char) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-4byte-char

NPM version Bower version Build Status Coverage Status Dependency Status Dependency Status

Check if a given value is a character that costs 4 bytes in UTF-8

import is4byteChar from 'is-4byte-char';

is4byteChar('1'); //=> false
is4byteChar('🔶'); //=> true

Installation

npm

npm install is-4byte-char

Bower

bower install is-4byte-char

is4byteChar(val)

val: any types
Return: Boolean

It returns true if the argument is a 4-byte character in UTF-8, otherwise false.

is4byteChar(String.fromCodePoint(0x0080)); //=> false
is4byteChar(String.fromCodePoint(0x0800)); //=> false
is4byteChar(String.fromCodePoint(0x10000)); //=> true

// Non-string value
is4byteChar(123); //=> false

License

Copyright (c) 2016 Shinnosuke Watanabe

Licensed under the MIT License.