optimizers

Optimizers

A collection of minimal, dependency-free, performance-focused utilities for improving and compressing code or data in modern web and edge environments.

Overview

Optimizers provides safe, auditable modules designed to make code smaller and faster with conservative transformations and no runtime dependencies. Each tool focuses on a single responsibility and runs without build steps or runtime polyfills.

Available modules:

All helpers are designed for use in:

Each module has its own README.md, tests, and can be imported individually.

🔗 Live Demos (GitHub Pages)

You can try each optimizer interactively in your browser:

Each page loads its corresponding module.

Use

Import individual ESM files directly. No package installation or build is required.

To run the dependency-free regression tests with Node.js 22+:

node --experimental-default-type=module --test tests/*.test.mjs

Benchmarks and gzip badges refresh through manually dispatched workflows only; correctness tests still run on pushes and PRs.

Behavior and limitations

Design Principles

  1. Safety first: Never execute or interpret arbitrary code during optimization.
  2. No dependencies: All logic is pure ESM JavaScript.
  3. Performance: Runs in O(n) time on typical input.
  4. Portability: Works the same in browser, Node, and edge runtimes.
  5. Transparency: Fully open-source, easy to audit.

Example usage

import { optimizeDataset } from './is-dataset-minify/dataset.js';
import { optimizeGoogleTag } from './is-google-tag/gtag.js';
import { minifyHTML } from './is-html-minify/html.js';
import { minifyJS, minifyCSS } from './is-minify/minify.js';
import { optimizePrompt } from './is-prompt-minify/prompt.js';
import { stripAnsi } from './is-strip-ansi/strip.js';

console.log(optimizeDataset('[{"id":1},{"id":1}]', { format: 'json' }));
console.log(optimizeGoogleTag('G-TEST123'));        // GA4 script snippet
console.log(minifyHTML('<p>Hello  world</p>'));
console.log(minifyJS('function x () { return 42; }'));
console.log(minifyCSS('body { color: red; }'));
console.log(optimizePrompt('Please keep this.').optimized); // phrase preserved
console.log(stripAnsi('\u001b[31mError\u001b[0m'));       // 'Error'

Folder Structure

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/

Security Notes

Contributing

Pull requests for small, behavior-preserving optimizers are welcome. Please maintain the following rules:

License

Licensed under the MIT License — see LICENSE.

Funding

If you find this project useful, please consider sponsoring its continued maintenance and security audits.

You can sponsor this project through:


© 2025 Y Consulting LLC / Optimizers Project