maxmin

Get a pretty output of the original, minified, gzipped size of a string or buffer: 130 B → 91 B → 53 B (gzip)

MIT 12 个版本
安装
npm install maxmin
yarn add maxmin
pnpm add maxmin
bun add maxmin
README

maxmin

Get a pretty output of the original, minified, gzipped size of a string or buffer

Useful for logging the difference between original and minified file in, for example, a build-system.

Install

npm install maxmin

Usage

import maxmin from 'maxmin';

const max = 'function smoothRangeRandom(min,max){var num=Math.floor(Math.random()*(max-min+1)+min);return this.prev=num===this.prev?++num:num};';

const min = '(function(b,c){var a=Math.floor(Math.random()*(c-b+1)+b);return this.a=a===this.a?++a:a})()';

console.log(maxmin(max, min, true));
//=> '130 B → 91 B → 53 B (gzip)'

API

maxmin(max, min, useGzip?)

max

Type: string | Buffer | number

Original string or its size in bytes.

min

Type: string | Buffer | number

Minified string or its size in bytes.

useGzip

Type: boolean
Default: false

Show gzipped size of min. Pretty slow. Not shown when min is a number.

版本列表
4.1.0 2024-06-04
4.0.0 2021-05-03
3.0.0 2020-07-03
2.1.0 2015-12-23
2.0.0 2015-11-14
1.1.0 2015-03-29
1.0.1 2015-02-24
1.0.0 2014-08-09
0.2.2 2014-07-10
0.2.1 2014-07-04
0.2.0 2014-04-18
0.1.0 2014-02-28