code-points
Get the UTF-16-encoded code points of each character in the string
; //=> [72, 101, 108, 108, 111, 44, 32, 19990, 30028]
Installation
npm install code-points
API
codePoints(str, option)
str: string
option: Object
Return: Array<integer>
It returns the code points of each character in the string as an array.
; //=> [56026]; //=> [57311, 56026, 56026]; //=> [814047, 56026]
option.unique
Type: boolean
Default: false
Removes duplicates from result.
; //=> [98, 97, 110, 97, 110, 97]; //=> [98,97,110]
License
Copyright (c) 2014 - 2019 Shinnosuke Watanabe
Licensed under the MIT License.