Skip to content

Commit

Permalink
feat: single index file for exports added
Browse files Browse the repository at this point in the history
  • Loading branch information
petrlipatov committed Sep 1, 2024
1 parent 236121f commit a94f6ea
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 28 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "rutf8-toolkit",
"version": "0.1.0-alpha.1",
"description": "Serialization and compression toolkit for Cyrillic text",
"main": "prod.js",
"scripts": {
"build": "tsc",
"test": "jest"
Expand Down
2 changes: 0 additions & 2 deletions src/algorithms/bwt/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/algorithms/huffman/index.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/algorithms/lz77/encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ import { NULL_UNICODE } from "./utils/constants";

/**
* LZ77 encodes repeated patterns using tuples [offset, length, next-unmatched-symbol]:
*
* `offset` -> The distance (in characters) from the current position to the start of
* the previous occurrence of the repeated pattern in the window.
*
* `length` -> The number of characters that match the repeated pattern, indicating
* the length of the sequence that is duplicated.
*
* `next-unmatched-symbol` -> The next symbol in the stream that does not participate in
* the current pattern match, which will be encoded as a literal.
*/
Expand Down
3 changes: 0 additions & 3 deletions src/algorithms/lz77/index.ts

This file was deleted.

Empty file removed src/algorithms/rle/index.ts
Empty file.
2 changes: 1 addition & 1 deletion src/algorithms/rle/rleDecoder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { extractSymbolAndCount } from "./utils/helpers";

export function rleDecompress(input: string): string {
export function rleDecode(input: string): string {
if (input.length === 0) return "";

let output = "";
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/rle/rleEncoder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SPECIAL_CHAR } from "./utils/constants";

export function rleCompress(input: string): string {
export function rleEncode(input: string): string {
if (input.length === 0) {
throw new Error("Input string cannot be empty.");
}
Expand Down
4 changes: 0 additions & 4 deletions src/algorithms/rutf8/index.ts

This file was deleted.

37 changes: 37 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// rutf8
export { rutf8Decode } from "./algorithms/rutf8/rutf8Decoder";
export { rutf8Encode } from "./algorithms/rutf8/rutf8Encoder";
export { rutf8BinaryDecode } from "./algorithms/rutf8/binaryDecoder";
export { rutf8BinaryEncode } from "./algorithms/rutf8/binaryEncoder";

// huffman

export { huffmanBinaryEncode } from "./algorithms/huffman/binaryEncoder";
export { huffmanBinaryDecode } from "./algorithms/huffman/binaryDecoder";
export { createHuffmanTree } from "./algorithms/huffman/utils/huffman-tree";

// lzss

export { lzssBinaryEncode } from "./algorithms/lzss/binaryEncoder";
export { lzssBinaryDecode } from "./algorithms/lzss/binaryDecoder";
export { lzssEncode } from "./algorithms/lzss/encoder";

// lz77

export { lz77BinaryDecode } from "./algorithms/lz77/binaryDecoder";
export { lz77BinaryEncode } from "./algorithms/lz77/binaryEncoder";
export { lz77Encode } from "./algorithms/lz77/encoder";

// bwt

export { bwtEncode } from "./algorithms/bwt/bwtEncode";
export { bwtDecode } from "./algorithms/bwt/bwtDecode";

// rle

export { rleEncode } from "./algorithms/rle/rleEncoder";
export { rleDecode } from "./algorithms/rle/rleDecoder";

// other

export { calculateOptimalBytesCompression } from "./tools/entropy";
2 changes: 1 addition & 1 deletion tests/bwt/bwtDecoder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "@jest/globals";
import { bwtDecode } from "../../src/algorithms/bwt";
import { bwtDecode } from "../../src";

import { END_OF_STRING } from "../../src/algorithms/bwt/utils/constants";

Expand Down
2 changes: 1 addition & 1 deletion tests/bwt/bwtEncoder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "@jest/globals";
import { bwtEncode } from "../../src/algorithms/bwt";
import { bwtEncode } from "../../src";

import { END_OF_STRING } from "../../src/algorithms/bwt/utils/constants";

Expand Down
5 changes: 1 addition & 4 deletions tests/huffman/binaryDecoder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { describe, expect, it } from "@jest/globals";
import {
huffmanBinaryEncode,
huffmanBinaryDecode,
} from "../../src/algorithms/huffman";
import { huffmanBinaryEncode, huffmanBinaryDecode } from "../../src";

import { SP_ENG_200 } from "../samples/common.samples";

Expand Down
2 changes: 1 addition & 1 deletion tests/lz77/binaryDecoder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "@jest/globals";
import { lz77BinaryEncode, lz77BinaryDecode } from "../../src/algorithms/lz77";
import { lz77BinaryEncode, lz77BinaryDecode } from "../../src";

import { SP_ENG_200 } from "../samples/common.samples";

Expand Down
2 changes: 1 addition & 1 deletion tests/lzss/binaryDecoder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "@jest/globals";
import { lzssBinaryEncode, lzssBinaryDecode } from "../../src/algorithms/lzss";
import { lzssBinaryEncode, lzssBinaryDecode } from "../../src";

import { SP_ENG_200 } from "../samples/common.samples";

Expand Down
5 changes: 1 addition & 4 deletions tests/rutf8/binaryDecoder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { describe, expect, it } from "@jest/globals";
import {
rutf8BinaryEncode,
rutf8BinaryDecode,
} from "../../src/algorithms/rutf8";
import { rutf8BinaryEncode, rutf8BinaryDecode } from "../../src";

import { SP_ENG_200 } from "../samples/common.samples";

Expand Down
2 changes: 1 addition & 1 deletion tests/rutf8/rutf8Decoder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "@jest/globals";
import { rutf8Decode } from "../../src/algorithms/rutf8";
import { rutf8Decode } from "../../src";
import { SP_RUS_30, SP_RUS_200 } from "../samples/common.samples";
import { RUTF8_SP_RUS_200, RUTF8_SP_RUS_30 } from "../samples/rutf8.samples";

Expand Down
2 changes: 1 addition & 1 deletion tests/rutf8/rutf8Encoder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from "@jest/globals";
import { rutf8Encode } from "../../src/algorithms/rutf8";
import { rutf8Encode } from "../../src";
import { SP_RUS_30, SP_RUS_200 } from "../samples/common.samples";
import { RUTF8_SP_RUS_200, RUTF8_SP_RUS_30 } from "../samples/rutf8.samples";

Expand Down

0 comments on commit a94f6ea

Please sign in to comment.