Registry / storage / jminor

jminor

JSON →
library1.0.1jsnpmunverified

A configurable two-way JSON minifier that reduces payload size by replacing long keys with short generated ones, producing a translation dictionary. Current stable version 1.0.1. Release cadence is low (last update years ago). Key differentiator: supports reversible compression (minify and restore) and custom key generators. Suitable for both client and server (Node.js, browser via UMD).

npm install jminor
INSTALL
IMPORT
SIG · JMINOR
J
jminor
storagejavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createDictionary
import { createDictionary } from 'jminor'
const createDictionary = require('jminor').createDictionary
ESM import is preferred. CommonJS also works via require('jminor').createdictionary (but note lowercase).
compress
import { compress } from 'jminor'
import compress from 'jminor'
Default export does not exist; must use named import.
Dictionary
import { Dictionary } from 'jminor'
TypeScript type/interface export for TypeScript users.
createDefaultKeyGenerator
import { createDefaultKeyGenerator } from 'jminor'
import { createDefaultKeyGenerator } from 'jminor/generators/defaultKeyGenerator'
The function is re-exported at the package root; no need to deep-import. Also available as named export.

Creates a dictionary, compresses an object by shortening keys, then decompresses back to original keys.

import { createDictionary, compress, decompress } from 'jminor'; // Create dictionary and load data const dictionary = createDictionary(); const originalData = { user_id: 123, profile_name: 'Alice', email_address: 'alice@example.com' }; dictionary.fromJSON(originalData); // Compress const compressed = compress(originalData, dictionary); console.log('Compressed:', JSON.stringify(compressed)); // Decompress const decompressed = decompress(compressed, dictionary); console.log('Decompressed:', JSON.stringify(decompressed));
Debug
Known issues
gotchaDictionary must be populated with fromJSON() or extendWith() before compress/decompress; otherwise no keys are mapped.
fix
Always call dictionary.fromJSON(data) before compressing, or use import/export of dictionary.
affects: >=1.0.0
gotchaKeys that contain only falsy values (null, false, 0, empty array/object?) are omitted from compressed output by default? Check documentation for compression config.
fix
If needed, preserve empty structures by adjusting compression options (e.g., keepEmpty).
affects: >=1.0.0
gotchaNested arrays of objects: only first object's keys are considered? The minifier might skip keys that appear only in later array elements, leading to loss on decompress.
fix
Ensure consistent key structure across all objects in arrays, or use extendWith() to add keys from all objects.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: dictionary.fromJSON is not a function
Importing createDictionary incorrectly (e.g., using default import) results in undefined dictionary methods.
fix
Use named import: import { createDictionary } from 'jminor'; const dict = createDictionary();
Cannot read property 'a' of undefined - during decompress
Dictionary not populated with the original keys before compression; compressed data references keys not in dictionary.
fix
Always call dictionary.fromJSON(originalData) BEFORE compress(originalData, dictionary).
ReferenceError: decompress is not defined - when using require()
CommonJS require returns an object with a lowercase 'decompress' property. Some may expect uppercase.
fix
Use require('jminor').decompress (or destructure with correct casing).
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources
packagejminor
jminor — npm install jminor · libregistry