dyna-compress-text
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -11,5 +11,5 @@ export interface IDecompressTextResult { | ||
decompress(compressed: string): IDecompressTextResult; | ||
private getCode(partialText); | ||
private encode(partialText); | ||
private encodeIndex(index); | ||
private decodeIndex(text); | ||
} |
@@ -136,5 +136,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
commonTexts = commonTexts.concat(Object.keys(obj).map(function (key) { | ||
debugger; | ||
if (key === "date2") | ||
debugger; | ||
if (Array.isArray(obj[key])) | ||
@@ -206,2 +203,3 @@ return "\"" + key + "\":["; | ||
.filter(function (text) { return text !== compressSymbol; }) | ||
.filter(function (text) { return !!text; }) | ||
.sort(function (textA, textB) { return textA.length - textB.length; }) | ||
@@ -214,3 +212,3 @@ .reverse(); | ||
for (var iChar = 0; iChar < text.length; iChar++) { | ||
var code = this.getCode(text.substr(iChar)); | ||
var code = this.encode(text.substr(iChar)); | ||
if (code) { | ||
@@ -249,3 +247,3 @@ output += code; | ||
}; | ||
DynaTextCompress.prototype.getCode = function (partialText) { | ||
DynaTextCompress.prototype.encode = function (partialText) { | ||
var _this = this; | ||
@@ -252,0 +250,0 @@ var output = null; |
{ | ||
"name": "dyna-compress-text", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Compress strings and objects learning the compressor how to do that.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -67,4 +67,2 @@ import {DynaTextCompress, IDecompressTextResult} from "./DynaTextCompress"; | ||
commonTexts = commonTexts.concat(Object.keys(obj).map((key: string) => { | ||
debugger; | ||
if (key==="date2") debugger; | ||
if (Array.isArray(obj[key])) return `"${key}":[`; | ||
@@ -71,0 +69,0 @@ if (obj[key] instanceof Date) return `"${key}":"`; |
@@ -29,2 +29,3 @@ export interface IDecompressTextResult { | ||
.filter((text: string) => text !== compressSymbol) | ||
.filter((text: string) => !!text) | ||
.sort((textA: string, textB: string) => textA.length - textB.length) | ||
@@ -38,3 +39,3 @@ .reverse(); | ||
for (let iChar: number = 0; iChar < text.length; iChar++) { | ||
let code = this.getCode(text.substr(iChar)); | ||
let code = this.encode(text.substr(iChar)); | ||
if (code) { | ||
@@ -74,3 +75,3 @@ output += code; | ||
private getCode(partialText: string): string { | ||
private encode(partialText: string): string { | ||
let output = null; | ||
@@ -77,0 +78,0 @@ this.commonTexts.forEach((word, index) => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
72805
39
1520