Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

compress-json

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compress-json - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

dist/helpers.d.ts

1

dist/boolean.js
"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) {

@@ -4,0 +5,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");

@@ -4,0 +5,0 @@ const encode_1 = require("./encode");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.throwUnknownDataType = exports.getType = void 0;
function getType(o) {

@@ -4,0 +5,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");

@@ -4,0 +5,0 @@ function encodeNum(num) {

export { compress, decompress, Compressed } from './core';
export { decode } from './core';
export { addValue, Memory, Store, Cache } from './memory';
export { trimUndefined, trimUndefinedRecursively } from './helpers';

12

dist/index.js

@@ -5,8 +5,12 @@ "use strict";

var core_1 = require("./core");
exports.compress = core_1.compress;
exports.decompress = core_1.decompress;
Object.defineProperty(exports, "compress", { enumerable: true, get: function () { return core_1.compress; } });
Object.defineProperty(exports, "decompress", { enumerable: true, get: function () { return core_1.decompress; } });
/* for custom wrapper */
var core_2 = require("./core");
exports.decode = core_2.decode;
Object.defineProperty(exports, "decode", { enumerable: true, get: function () { return core_2.decode; } });
var memory_1 = require("./memory");
exports.addValue = memory_1.addValue;
Object.defineProperty(exports, "addValue", { enumerable: true, get: function () { return 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; } });
"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");

@@ -4,0 +5,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 = '';

@@ -4,0 +5,0 @@ for (let i = 0; i < 10; i++) {

{
"name": "compress-json",
"version": "2.0.1",
"version": "2.1.0",
"description": "convert JSON data to space efficient format",

@@ -5,0 +5,0 @@ "keywords": [

@@ -122,2 +122,21 @@ # compress-json

## Helper Functions
```typescript
import { compress } from 'compress-json'
import { trimUndefined, trimUndefinedRecursively } from 'compress-json'
let user = { name: 'Alice', role: undefined }
compress(user) // will throw an error since undefined field is not supported
trimUndefined(user) // explicitly remove undefined fields
compress(user) // now it will not throw error since user.role is deleted
let a = { name: 'a', extra: undefined }
let b = { name: 'b', a }
trimUndefinedRecursively(b)
compress(b) // now it will not throw error since b.a.extra is deleted
```
## Benchmark

@@ -124,0 +143,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc