Skip to content

Commit 7763a65

Browse files
committed
1 parent e3c7637 commit 7763a65

3 files changed

Lines changed: 42 additions & 37 deletions

File tree

index.js

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ SOFTWARE.
2525
*/
2626

2727
/*
28-
_______________
29-
__ / / __/ __/ ___/
30-
/ // /\ \_\ \/ /__
31-
\___/___/___/\___/
32-
33-
JavaScript String Compressor
34-
https://jssc.js.org/
28+
__ _______________ __
29+
\ \ __ / / __/ __/ ___/ / /
30+
> > / // /\ \_\ \/ /__ < <
31+
/_/ \___/___/___/\___/ \_\
32+
33+
JavaScript String Compressor
34+
https://jssc.js.org/
35+
36+
npm i strc
3537
3638
*/
3739

@@ -477,21 +479,21 @@ SOFTWARE.
477479
return binToDec(sixteenBits);
478480
}
479481
}
480-
/* Code 1 usage table */
481-
/* ------------------ */
482-
/* 00: No compression */
483-
/* 01: CharCode.len=2 */
484-
/* 02: ASCII in UTF16 */ /* Yeah ik thats not actually matches ASCII */
485-
/* 03: Integers (Any) */
486-
/* 04: Build Alphabet */
487-
/* 05: Char Encodings */
488-
/* 06: Integers (>15) */
489-
/* 07: Frequency Map */
490-
/* 08: URL to binary */
491-
/* 09: Segmt compress */
492-
/* 10: Repeating strs */
493-
/* 11 - 30: Reserved */
494-
/* 31: Rcrsv compress */
482+
/* Code 1 usage table */
483+
/* ------------------------------------ */
484+
/* 00: No Compression */
485+
/* 01: Two-Digit CharCode Concatenation */
486+
/* 02: Two-Byte CharCode Concatenation */
487+
/* 03: Decimal Integer Packing */
488+
/* 04: Alphabet Encoding */
489+
/* 05: Character Encoding */
490+
/* 06: Inline Integer Encoding */
491+
/* 07: Frequency Map */
492+
/* 08: URL */
493+
/* 09: Segmentation */
494+
/* 10: String Repetition */
495+
/* 11 - 30: Reserved */
496+
/* 31: Recursive Compression */
495497

496498
const SEQUENCE_MARKER = '\uDBFF'; /* Private Use Area */
497499

@@ -971,7 +973,7 @@ SOFTWARE.
971973
const candidates = [];
972974

973975
if (/^\d+$/.test(str)) {
974-
/* Integers ( < 15 ) */
976+
/* Inline Integer Encoding */
975977
candidates.push(async () => {
976978
const out = await (async () => {
977979
const num = parseInt(str);
@@ -986,7 +988,7 @@ SOFTWARE.
986988
if (!(await validate(out))) return null;
987989
return out;
988990
});
989-
/* Integers (any) */
991+
/* Decimal Integer Packing */
990992
candidates.push(async () => {
991993
const convertNums = {
992994
'A': 10,
@@ -1026,6 +1028,7 @@ SOFTWARE.
10261028
});
10271029
}
10281030

1031+
/* Two-Digit CharCode Concatenation */
10291032
candidates.push(async () => {
10301033
const strdata = stringCodes(str);
10311034
if (!(strdata.max === 2 && strdata.min === 2)) return null;
@@ -1068,7 +1071,7 @@ SOFTWARE.
10681071
return res;
10691072
});
10701073

1071-
/* ASCII in UTF-16 */
1074+
/* Two-Byte CharCode Concatenation */
10721075
candidates.push(async () => {
10731076
const strdata = stringCodes(str);
10741077
if (strdata.maxCharCode >= 256) return null;
@@ -1086,7 +1089,7 @@ SOFTWARE.
10861089
return res;
10871090
});
10881091

1089-
/* Character encodings */
1092+
/* Character Encoding */
10901093
candidates.push(async () => {
10911094
const characterEncodings = new _JSSC.use();
10921095
const stringArray = str.split('');
@@ -1136,7 +1139,7 @@ SOFTWARE.
11361139
return null;
11371140
});
11381141

1139-
/* Build alphabet */
1142+
/* Alphabet Encoding */
11401143
candidates.push(async () => {
11411144
const uniq = [...new Set(str.split('').map(c => c.charCodeAt(0)))];
11421145
if (uniq.length >= 16) return null;
@@ -1165,7 +1168,7 @@ SOFTWARE.
11651168
return res;
11661169
});
11671170

1168-
/* Frequency map */
1171+
/* Frequency Map */
11691172
candidates.push(async () => {
11701173
for (const splitter of freqMapSplitters) {
11711174
const test = freqMap.test(str, splitter);
@@ -1297,7 +1300,7 @@ SOFTWARE.
12971300
return res;
12981301
});
12991302

1300-
/* Repeating string */
1303+
/* String Repetition */
13011304
const rcheck = str.match(/^(.{1,7}?)(?:\1)+$/);
13021305
if (rcheck) candidates.push(async () => {
13031306
const main = rcheck[1];

index.min.js

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strc",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "JavaScript String Compressor - lossless string compression algorithm",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)