compress-json
Advanced tools
Comparing version 2.1.1 to 2.1.2
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.test = exports.bool_to_s = exports.s_to_bool = void 0; | ||
function s_to_bool(s) { | ||
@@ -5,0 +4,0 @@ switch (s) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.config = void 0; | ||
exports.config = { | ||
sort_key: false, | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.decompress = exports.decode = exports.compress = void 0; | ||
const debug_1 = require("./debug"); | ||
@@ -5,0 +4,0 @@ const encode_1 = require("./encode"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.throwUnknownDataType = exports.getType = void 0; | ||
function getType(o) { | ||
@@ -5,0 +4,0 @@ return Object.prototype.toString.call(o); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.decodeStr = exports.encodeStr = exports.decodeBool = exports.encodeBool = exports.decodeKey = exports.decodeNum = exports.encodeNum = void 0; | ||
const number_1 = require("./number"); | ||
@@ -5,0 +4,0 @@ function encodeNum(num) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.trimUndefinedRecursively = exports.trimUndefined = void 0; | ||
function trimUndefined(object) { | ||
@@ -5,0 +4,0 @@ for (const key in object) { |
@@ -5,12 +5,12 @@ "use strict"; | ||
var core_1 = require("./core"); | ||
Object.defineProperty(exports, "compress", { enumerable: true, get: function () { return core_1.compress; } }); | ||
Object.defineProperty(exports, "decompress", { enumerable: true, get: function () { return core_1.decompress; } }); | ||
exports.compress = core_1.compress; | ||
exports.decompress = core_1.decompress; | ||
/* for custom wrapper */ | ||
var core_2 = require("./core"); | ||
Object.defineProperty(exports, "decode", { enumerable: true, get: function () { return core_2.decode; } }); | ||
exports.decode = core_2.decode; | ||
var memory_1 = require("./memory"); | ||
Object.defineProperty(exports, "addValue", { enumerable: true, get: function () { return memory_1.addValue; } }); | ||
exports.addValue = memory_1.addValue; | ||
/* to remove undefined object fields */ | ||
var helpers_1 = require("./helpers"); | ||
Object.defineProperty(exports, "trimUndefined", { enumerable: true, get: function () { return helpers_1.trimUndefined; } }); | ||
Object.defineProperty(exports, "trimUndefinedRecursively", { enumerable: true, get: function () { return helpers_1.trimUndefinedRecursively; } }); | ||
exports.trimUndefined = helpers_1.trimUndefined; | ||
exports.trimUndefinedRecursively = helpers_1.trimUndefinedRecursively; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.addValue = exports.makeInMemoryMemory = exports.makeInMemoryCache = exports.makeInMemoryStore = exports.memToValues = void 0; | ||
const config_1 = require("./config"); | ||
@@ -5,0 +4,0 @@ const debug_1 = require("./debug"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.s_to_num = exports.int_str_to_s = exports.num_to_s = exports.big_int_to_s = exports.int_to_s = exports.s_to_big_int = exports.s_to_int = void 0; | ||
let i_to_s = ''; | ||
@@ -93,6 +92,26 @@ for (let i = 0; i < 10; i++) { | ||
} | ||
let c; | ||
if (b) { | ||
[b, c] = b.split('e'); | ||
} | ||
a = int_str_to_s(a); | ||
b = reverse(b); | ||
b = int_str_to_s(b); | ||
return a + '.' + b; | ||
let str = a + '.' + b; | ||
if (c) { | ||
str += '.'; | ||
switch (c[0]) { | ||
case '+': | ||
c = c.slice(1); | ||
break; | ||
case '-': | ||
str += '-'; | ||
c = c.slice(1); | ||
break; | ||
} | ||
c = reverse(c); | ||
c = int_str_to_s(c); | ||
str += c; | ||
} | ||
return str; | ||
} | ||
@@ -118,3 +137,3 @@ exports.num_to_s = num_to_s; | ||
} | ||
let [a, b] = s.split('.'); | ||
let [a, b, c] = s.split('.'); | ||
if (!b) { | ||
@@ -126,4 +145,16 @@ return s_to_int(a); | ||
b = reverse(b); | ||
return +(a + '.' + b); | ||
let str = a + '.' + b; | ||
if (c) { | ||
str += 'e'; | ||
let neg = false; | ||
if (c[0] === '-') { | ||
neg = true; | ||
c = c.slice(1); | ||
} | ||
c = s_to_int_str(c); | ||
c = reverse(c); | ||
str += neg ? -c : +c; | ||
} | ||
return +str; | ||
} | ||
exports.s_to_num = s_to_num; |
{ | ||
"name": "compress-json", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "convert JSON data to space efficient format", | ||
@@ -28,7 +28,2 @@ "keywords": [ | ||
}, | ||
"husky": { | ||
"hook": { | ||
"pre-commit": "npm run format" | ||
} | ||
}, | ||
"directories": { | ||
@@ -45,3 +40,2 @@ "test": "test" | ||
"compressed-json": "^1.0.15", | ||
"husky": "^4.2.5", | ||
"jsonpack": "^1.1.5", | ||
@@ -48,0 +42,0 @@ "prettier": "^2.0.5", |
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
12
609
25465