
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Fast precopmiled json stringify. Convenient API, very simple to use. Like JSON.stringify, but optimized for objects that are likely to share a common schema.
Use for logging, RPC, or other use cases where the object schema does not vary.
const json_comp = require('json-exec').json_comp;
const json_exec = require('json-exec').json_exec;
const coder = json_comp({ name: 'String', age: 123 });
json_exec(coder, { name: 'Mickey Mouse', age: 91, color: 'black' });
// => '{"name":"Mickey Mouse","age":91}'
json_exec(coder, { name: 'Minnie Mouse' });
// => '{"name":"Minnie Mouse","age":null}'
For example, to speed up the logging of fixed-pattern objects:
// auto-initialize the logline json encoder
var loglineCoder = loglineCoder || json_comp(logObject);
// log the json string
var logline = json_exec(loglineCoder, logObject);
logger.log(logline);
Build a json encoder to stringify the properties of the template. The template is a duck-typing description of the properties and types to encode from data objects; in particular, the template may be an instance of a data object.
The data object properties should be of the same type as the corresponding template
properties. A missing data property will be encoded as null
(instead of being skipped as
by JSON.stringify).
Use the encoder to stringify the data object according to the template. Missing values are
not skipped, they're stringified as null
. Properties that were not present in the template
are omitted.
json_comp
and json_exec
FAQs
fast templated json stringify
The npm package json-exec receives a total of 11 weekly downloads. As such, json-exec popularity was classified as not popular.
We found that json-exec 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.