Beautify JS from an input string or url.
.Maui Javascript Beautify API to beautify JS documents from an input string or url.
POSTGET *https://api.dotmaui.com/client/1.0/jsbeautify/
Parameters
| Field | Type | Description | Required |
|---|---|---|---|
| apikey | String |
.Maui Api key |
True |
| js | String |
JavaScript valid code |
1 |
| url | String |
Valid URL to a javascipt file |
1 |
1 There must be one of these values
Success 200 - Default Mode
It will be a string with JavaScript indented code
HTTP/1.1 200 OK
function myFunction(n, t) {
return n * t
}
var x = myFunction(4, 3);
Examples
import urllib.parse
import urllib.request
js_string = "var a=b(4,3);function b(a,b){return a*b;}"
params = urllib.parse.urlencode({'apikey': 'YOUR_API_KEY', 'js': js_string}).encode("utf-8")
beautiful = urllib.request.urlopen("https://api.dotmaui.com/client/1.0/jsbeautify/", data = params).read().decode("utf-8")
print(beautiful)
#var a = b(4, 3);
#
#function b(a, b) {
# return a * b;
#}
<?php
$data = array('apikey' => 'YOUR_API_KEY',
'url' => "https://code.jquery.com/jquery-3.2.1.min.js");
$curl = curl_init("https://api.dotmaui.com/client/1.0/jsbeautify/");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($curl);
curl_close($curl);
echo $output;