peter17/js-beautify-php

A JavaScript source code formatter written in PHP.

Fund package maintenance!
peter17

dev-master 2023-04-17 08:27 UTC

This package is auto-updated.

Last update: 2025-04-17 13:10:43 UTC


README

$obj = new JSBeautify('function escapeHtml(string){return String(string).replace(/[&<>"'`=\/]/g,function fromEntityMap(s){return entityMap[s]})}');
echo $obj->getResult();

the output will be

function escapeHtml(string) {
    return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap(s) {
        return entityMap[s]
    })
}