Comparing version
{ | ||
"name": "bigbit", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Implementation of BigBit standard for numeric data type and character encoding", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,3 +1,5 @@ | ||
'use restrict' | ||
const increase = require("../common/CyclicCounter"); | ||
const {getCodePoint} = require("../common/encoding"); | ||
const BigNumber = require("bignumber.js"); | ||
@@ -124,3 +126,15 @@ const powerOf128 = [ //exponentTableOf128 | ||
for(let i=0; i< str.length; i++){ | ||
let code = str.charCodeAt(i); | ||
var code = str.charCodeAt(i); | ||
if (code >= 0xD800 && code <= 0xDBFF && str.length > 1) { | ||
var second = str.charCodeAt(++i); | ||
if (second >= 0xDC00 && second <= 0xDFFF) { | ||
code = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; | ||
} | ||
} | ||
/* const code = str.codePointAt(i); | ||
if( code > 65535) i++; */ | ||
byteArr.push(...LBSequence.encode(code)); | ||
@@ -137,3 +151,3 @@ } | ||
let code = LBSequence.decode( byteArr, start ); | ||
str += String.fromCharCode( code.val ); | ||
str += String.fromCodePoint( code.val ); | ||
start += code.len; | ||
@@ -152,3 +166,2 @@ } | ||
module.exports = LBSequence; |
const increase = require("../common/CyclicCounter"); | ||
const {getCodePoint} = require("../common/encoding"); | ||
const powerOf128 = [ //exponentTableOf128 | ||
@@ -120,3 +121,12 @@ Math.pow(128, 0), | ||
for(let i=0; i< str.length; i++){ | ||
let code = str.charCodeAt(i); | ||
var code = str.charCodeAt(i); | ||
if (code >= 0xD800 && code <= 0xDBFF && str.length > 1) { | ||
var second = str.charCodeAt(++i); | ||
if (second >= 0xDC00 && second <= 0xDFFF) { | ||
code = (code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; | ||
} | ||
} | ||
byteArr.push(...LBSequence.encode(code)); | ||
@@ -133,3 +143,3 @@ } | ||
let code = LBSequence.decode( byteArr, start ); | ||
str += String.fromCharCode( code.val ); | ||
str += String.fromCodePoint( code.val ); | ||
start += code.len; | ||
@@ -136,0 +146,0 @@ } |
Sorry, the diff of this file is not supported yet
37228
5.91%12
9.09%801
3.76%