Skip to content

Commit

Permalink
feat: ESM and commonjs support added
Browse files Browse the repository at this point in the history
  • Loading branch information
petrlipatov committed Sep 1, 2024
1 parent 5a5da09 commit 948f389
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 29 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 4 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
{
"name": "rutf8-toolkit",
"version": "0.1.5-alpha.1",
"name": "rutf8-development",
"version": "0.2.4",
"description": "Serialization and compression toolkit for cyrillic payloads",
"scripts": {
"build": "tsc",
"scripts": {
"compile": "rm -rf dist/lib && tsc && tsc --build tsconfig.es5.json",
"test": "jest"
},
"files": [
"dist",
"README.md"
],
"keywords": [
"rutf8",
"compression",
"serialization",
"cyrillic",
"huffman",
"lz77",
"lzss",
"rle"
],
"author": "Petr Lipatov",
"license": "MIT",
"devDependencies": {
Expand Down
Binary file removed rutf8-toolkit-0.1.1-alpha.1.tgz
Binary file not shown.
10 changes: 10 additions & 0 deletions src/algorithms/bwt/bwtEncode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { END_OF_STRING } from "./utils/constants";

/**
* Encodes a given string using the Burrows-Wheeler Transform (BWT).
*
* The function generates all cyclic permutations of the input string, sorts them
* lexicographically, and constructs the BWT string from the last characters of each
* permutation. It also returns the index of the original string in the sorted list of permutations.
*
* @param {string} input - The string to be encoded using the Burrows-Wheeler Transform.
* @returns {{ bwt: string; index: number }} An object containing the encoded BWT string and the index of the original string.
*/
export function bwtEncode(input: string): { bwt: string; index: number } {
input += END_OF_STRING;

Expand Down
1 change: 0 additions & 1 deletion src/algorithms/lz77/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export type Encoding = [number, number, string];
export type Match = Encoding;
export type EncodedArray = Encoding[];
export type Options = {
// charEncodingLength: "UTF8" | "UTF16";
searchBufferLength: number;
lookaheadLength: number;
};
15 changes: 15 additions & 0 deletions tsconfig.es5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES5",
"module": "CommonJS",
"lib": ["ES2020", "dom"],
"outDir": "./dist/lib/es5",
"rootDir": "./src",
"downlevelIteration": true,
"noImplicitAny": false,
"declaration": true,
"moduleResolution": "node"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
13 changes: 5 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{
"compilerOptions": {
"target": "ES5",
"module": "ES2015",
"lib": ["es2015", "dom"],
"outDir": "./dist",
"module": "ES6",
"lib": ["ES2020", "dom"],
"outDir": "./dist/lib/es6",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"downlevelIteration": true,
"noImplicitAny": false,
"declaration": true
"declaration": true,
"moduleResolution": "node"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
Expand Down

0 comments on commit 948f389

Please sign in to comment.