A collection of minimal, dependency-free, performance-focused utilities for improving and compressing code or data in modern web and edge environments.
Optimizers provides safe, auditable modules designed to make code smaller and faster without unsafe parsing or heavy dependencies. Each tool focuses on a single responsibility and runs without build steps or runtime polyfills.
Available modules:
is-dataset-minify — High-performance dataset optimizer for JSON, JSONL, and CSV.
is-google-tag — Optimizes Google Tag for async, non-blocking, privacy-safe loading.
is-html-minify — Safe HTML minifier that removes comments and collapses whitespace while preserving <pre>, <textarea>, <script>, and <style> content.
is-minify — Safe, dependency-free JavaScript and CSS minifier for browser and Node.
is-prompt-minify — Compact large language model (LLM) prompts by removing redundancy, extra whitespace, and repeated phrases without altering meaning.
is-strip-ansi — Removes ANSI escape sequences (color codes, control characters) from strings safely.
All helpers are designed for use in:
Each module has its own README.md, tests, and can be imported individually.
You can try each validator interactively in your browser:
Each page loads its respective module and allows interactive validation.
npm i @yvancg/optimizers
or per-module packages when published
import { optimizeDataset } from './is-dataset/dataset.js';
import { optimizeGTag } from './is-google-tag/gtag.js';
import { minifyHTML } from './is-html-minify/html.js';
import { minifyJS, minifyCSS } from './is-minify/minify.js';
import { promptMinify } from './is-prompt-minify/prompt.js';
import { stripAnsi } from './is-strip-ansi/strip.js';
console.log(generateDataset({ count: 3, format: 'jsonl', seed: 'demo' }));
// → '{"id":"...","text":"Lorem ipsum ..."}'
console.log(
optimizeDataset(
'[{"id":1,"Text":" Hello world "},{"id":1,"Text":"Hello world"}]',
{ format: 'json', keyCase: 'snake', dropDuplicateRows: true }
)
);
// → '[{"id":1,"text":"Hello world"}]'
console.log(optimizeGTag('<script src="https://www.googletagmanager.com/gtag/js?id=G-TEST"></script>'));
// → optimized, async, privacy-safe version of the tag
console.log(minifyHTML(`
<!-- comment -->
<div class="box">
<p> Hello world </p>
<pre> keep this </pre>
<script> const x = 1 + 2 </script>
</div>
`));
// → '<div class="box"><p>Hello world</p><pre> keep this </pre><script> const x = 1 + 2 </script></div>'
console.log(minifyJS('function x () { return 1 + 2 ; }'));
// → 'function x(){return 1+2;}'
console.log(minifyCSS('body { color : red ; }'));
// → 'body{color:red;}'
console.log(promptMinify('You are a helpful helpful AI assistant. Please please respond clearly clearly.'));
// → 'You are a helpful AI assistant. Please respond clearly.'
console.log(stripAnsi('\u001B[31mError:\u001B[0m invalid token'));
// → 'Error: invalid token'
validators/
├─ .github/
│ ├─ workflows/
│ └─ FUNDING.yml
├─ LICENSE
├─ README.md
├─ SECURITY.md
├─ catalog.json
├─ is-dataset-minify/
├─ is-google-tag/
├─ is-html-minify/
├─ is-minify/
├─ is-prompt-minify/
├─ is-strip-ansi/
├─ bench/
└─ metrics/
Function() calls.Pull requests for additional safe validators (e.g., IBAN, domain names, etc.) are welcome. Please maintain the following rules:
Licensed under the MIT License — see LICENSE.
If you find this project useful, please consider sponsoring its continued maintenance and security audits.
You can sponsor this project through:
.github/FUNDING.yml© 2025 Y Consulting LLC / Optimizers Project