putoutjs / minify

Minify with help of 🐊Putout
MIT License
12 stars 3 forks source link

Remove required strict equal #16

Closed sirenkovladd closed 5 months ago

sirenkovladd commented 5 months ago

remove required strict equal

import { minify } from "@putout/minify";

const wrap = (name, v) => {
  eval(`
    let o,t=0,c='';
    ${v}
    console.log("${name}:", o);
  `)
}

const source = `o=t===c?1:2`;
wrap('source', source)
const result = minify(source);
console.log(result);
wrap('result', result)
❯ node test.js
source: 2
o=t==c?1:2;
result: 1
coderaiser commented 5 months ago

Added an option 🎉, just use:

import {minify} from "@putout/minify";

minify(code, {
    convertStrictEqualToEqual: false,
});

Is it works for you?

sirenkovladd commented 5 months ago

thank you

sirenkovladd commented 5 months ago

But I think that this option should be disabled by default, since using it will lead to errors and a bad experience

coderaiser commented 5 months ago

Submit PR https://github.com/putoutjs/minify/issues/21#issuecomment-2159960333, and I merge and publish major version.

coderaiser commented 5 months ago

Landed in v4.0.0 🎉