
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@jeash/data-transformer
Advanced tools
Data Transformer is a powerful tool that allows you to quickly and easily minify and magnify your data by converting the keys. With this library, you can reduce the size of your payloads and optimize your code for faster performance.
Use the package manager npm.
npm i @jeash/data-transformer
const transformer = require("@jeash/data-transformer")
const data = {
very_long_word: 'very_long_word',
longer_word: 'very_long_word',
object_foo: { foo: 'foo', bar: 'bar' },
array_foo: [ 'foo', 'bar' ],
object_array_foo: [ { foo: 'foo', bar: 'bar' }, { foo: 'foo', bar: 'bar' } ]
}
const dictionary = transformer.generateDictionary(data);
// This will return the following
{
very_long_word: 'vlw',
longer_word: 'lw',
foo: 'f',
bar: 'b',
object_foo: 'of',
array_foo: 'af',
object_array_foo: 'oaf'
}
const transformer = require("@jeash/data-transformer")
const data = {
very_long_word: 'very_long_word',
longer_word: 'very_long_word',
object_foo: { foo: 'foo', bar: 'bar' },
array_foo: [ 'foo', 'bar' ],
object_array_foo: [ { foo: 'foo', bar: 'bar' }, { foo: 'foo', bar: 'bar' } ]
}
const dictionary = {
very_long_word: 'vlw',
longer_word: 'lw',
foo: 'f',
bar: 'b',
object_foo: 'of',
array_foo: 'af',
object_array_foo: 'oaf'
}
const minified = transformer.minify(data, dictionary)
// This will return the following
{
vlw: 'very_long_word',
lw: 'very_long_word',
of: { f: 'foo', b: 'bar' },
af: [ 'foo', 'bar' ],
oaf: [ { f: 'foo', b: 'bar' }, { f: 'foo', b: 'bar' } ]
}
const transformer = require("@jeash/data-transformer")
const data = {
vlw: 'very_long_word',
lw: 'very_long_word',
of: { f: 'foo', b: 'bar' },
af: [ 'foo', 'bar' ],
oaf: [ { f: 'foo', b: 'bar' }, { f: 'foo', b: 'bar' } ]
}
const dictionary = {
very_long_word: 'vlw',
longer_word: 'lw',
foo: 'f',
bar: 'b',
object_foo: 'of',
array_foo: 'af',
object_array_foo: 'oaf'
}
const magnified= transformer.minify(data, dictionary)
// This will return the following
{
very_long_word: 'very_long_word',
longer_word: 'very_long_word',
object_foo: { foo: 'foo', bar: 'bar' },
array_foo: [ 'foo', 'bar' ],
object_array_foo: [ { foo: 'foo', bar: 'bar' }, { foo: 'foo', bar: 'bar' } ]
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
FAQs
Minify or magnify your data depending on your needs
The npm package @jeash/data-transformer receives a total of 3 weekly downloads. As such, @jeash/data-transformer popularity was classified as not popular.
We found that @jeash/data-transformer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.