Comparing version 0.0.769 to 0.0.770
@@ -0,1 +1,2 @@ | ||
import { encode as encodePercent, decode as decodePercent } from './ascii.percent'; | ||
import { encode as encodeToken, decode as decodeToken } from './ascii.token'; | ||
@@ -416,11 +417,19 @@ | ||
.includes(String.fromCharCode(i))); | ||
function reset(): void { | ||
randstate = false; | ||
hexstate = 0; | ||
} | ||
function clear(): void { | ||
reset(); | ||
freq = 0; | ||
hexstate = 0; | ||
randstate = false; | ||
sep = 0x20; | ||
opts.skip = 0; | ||
hopts.skip = 0; | ||
} | ||
const opts = { | ||
const popts = { | ||
start: 0, | ||
next: 0, | ||
}; | ||
const hopts = { | ||
target: random, | ||
@@ -442,9 +451,2 @@ start: 0, | ||
if (j === 0) { | ||
if (huffman && randstate && i >= opts.skip) { | ||
opts.start = opts.skip = i; | ||
output += encodeToken(input, opts); | ||
i = opts.next === i ? i - 1 : opts.next - 1; | ||
randstate = false; | ||
continue; | ||
} | ||
if (i + 1 === input.length) { | ||
@@ -454,2 +456,19 @@ output += ASCII[code]; | ||
} | ||
if (code === 0x25) { | ||
popts.start = i; | ||
output += encodePercent(input, tablesH[0], popts) || '%'; | ||
i = popts.next === i ? i + 1 : popts.next; | ||
output += input[i] ?? ''; | ||
base = input.charCodeAt(i); | ||
reset(); | ||
continue; | ||
} | ||
if (huffman && randstate && i >= hopts.skip) { | ||
hopts.start = hopts.skip = i; | ||
output += encodeToken(input, hopts); | ||
i = hopts.next - 1; | ||
base = input.charCodeAt(i); | ||
reset(); | ||
continue; | ||
} | ||
const comp = axis === axisH && isHEX(code) >>> 4 !== 0; | ||
@@ -459,3 +478,3 @@ const delta = comp | ||
: encCode(code, base, axis); | ||
if (delta >>> 4 || axis === axisH && !comp || i < opts.skip) { | ||
if (delta >>> 4 || axis === axisH && !comp || i < hopts.skip) { | ||
output += ASCII[code]; | ||
@@ -494,3 +513,2 @@ } | ||
base = code; | ||
randstate &&= i !== 0; | ||
} | ||
@@ -511,3 +529,12 @@ assert(buffer === 0); | ||
assert(code >>> 8 === 0); | ||
if (code <= 0x7f) { | ||
if (code === 0x25) { | ||
popts.start = i; | ||
output += decodePercent(input, tablesH[1], popts) || '%'; | ||
i = popts.next === i ? i + 1 : popts.next; | ||
output += input[i] ?? ''; | ||
base = output.charCodeAt(output.length - 1); | ||
reset(); | ||
continue; | ||
} | ||
else if (code <= 0x7f) { | ||
output += ASCII[code]; | ||
@@ -517,6 +544,7 @@ sep = seps[code] || sep; | ||
else if (huffman && randstate) { | ||
opts.start = i; | ||
output += decodeToken(input, opts); | ||
i = opts.next - 1; | ||
randstate = false; | ||
hopts.start = i; | ||
output += decodeToken(input, hopts); | ||
i = hopts.next - 1; | ||
base = output.charCodeAt(output.length - 1); | ||
reset(); | ||
continue; | ||
@@ -541,5 +569,4 @@ } | ||
caseH = segment(base) <= Segment.Lower ? segment(base) + 1 : caseH; | ||
randstate &&= i !== 0; | ||
} | ||
return output; | ||
} |
{ | ||
"name": "spica", | ||
"version": "0.0.769", | ||
"version": "0.0.770", | ||
"description": "Supervisor, Coroutine, Channel, select, AtomicPromise, Cancellation, Cache, List, Queue, Stack, and some utils.", | ||
@@ -5,0 +5,0 @@ "private": false, |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
796375
238
26160