diff --git a/dist/easycoder-min.js b/dist/easycoder-min.js index 18b0b75..27735be 100644 --- a/dist/easycoder-min.js +++ b/dist/easycoder-min.js @@ -123,8 +123,8 @@ f.preventDefault())};document.addEventListener?document.addEventListener("click" a.onSwipeLeft?a.run(a.onSwipeLeft):0>f&&a.onSwipeRight&&a.run(a.onSwipeRight)))},!1);break;case "pick":d=a.getSymbolRecord(b.symbol);document.pickRecord=d;d.element.forEach(function(f,g){document.pickIndex=g;f.pickIndex=g;f.mouseDownPc=b.pc+2;"ontouchstart"in f?(f.addEventListener("touchstart",function(h){var k=h.targetTouches[0].target;document.pickX=h.touches[0].clientX;document.pickY=h.touches[0].clientY;k.blur();setTimeout(function(){document.pickRecord.index=k.pickIndex;a.run(k.mouseDownPc)}, 1)},!1),f.addEventListener("touchmove",function(h){document.dragX=h.touches[0].clientX;document.dragY=h.touches[0].clientY;setTimeout(function(){a.run(document.mouseMovePc)},1);return!1},!1),f.addEventListener("touchend",function(){setTimeout(function(){a.run(document.mouseUpPc)},1);return!1})):f.onmousedown=function(h){h=h?h:window.event;h.stopPropagation();if(0=c&&a<=e&&b>=f&&b<=d?!0:!1}}},setStyles:function(a,b){a=document.getElementById(a); b=b.split(";");b=$jscomp.makeIterator(b);for(var c=b.next();!c.done;c=b.next())c=c.value.split(":"),a.setAttribute(c[0],c[1])}},scrollPosition=0;window.addEventListener("scroll",function(){scrollPosition=this.scrollY});window.onpopstate=function(a){window.EasyCoder.timestamp=Date.now();(a=JSON.parse(a.state))&&a.script&&((a=window.EasyCoder.scripts[a.script])?a.onBrowserBack&&a.run(a.onBrowserBack):console.log("No script property in window state object"))}; -var EasyCoder_Json={name:"EasyCoder_JSON",Json:{compile:function(a){var b=a.getLino(),c=a.nextToken();switch(c){case "set":a.next();if(a.isSymbol())if(c=a.getSymbolRecord(),"variable"===c.keyword){if(a.nextTokenIs("to")){var d=a.nextToken();if('["array","object"]'.includes(d))return a.next(),a.addCommand({domain:"json",keyword:"json",lino:b,request:"setVariable",target:c.name,type:d}),!0}}else if("select"===c.keyword&&a.nextTokenIs("from")&&(a.next(),a.isSymbol()&&(d=a.getSymbolRecord(),"variable"=== +var EasyCoder_Json={name:"EasyCoder_Json",Json:{compile:function(a){var b=a.getLino(),c=a.nextToken();switch(c){case "set":a.next();if(a.isSymbol())if(c=a.getSymbolRecord(),"variable"===c.keyword){if(a.nextTokenIs("to")){var d=a.nextToken();if('["array","object"]'.includes(d))return a.next(),a.addCommand({domain:"json",keyword:"json",lino:b,request:"setVariable",target:c.name,type:d}),!0}}else if("select"===c.keyword&&a.nextTokenIs("from")&&(a.next(),a.isSymbol()&&(d=a.getSymbolRecord(),"variable"=== d.keyword))){var e=null;a.nextTokenIs("as")&&(e=a.getNextValue());a.addCommand({domain:"json",keyword:"json",lino:b,request:"setList",target:c.name,source:d.name,display:e});return!0}break;case "sort":case "shuffle":case "format":if(a.nextIsSymbol()&&(d=a.getSymbolRecord(),"variable"===d.keyword))return a.next(),a.addCommand({domain:"json",keyword:"json",lino:b,request:c,target:d.name}),!0;break;case "parse":if(a.nextTokenIs("url")&&(d=a.getNextValue(),a.tokenIs("as")&&a.nextIsSymbol()&&(e=a.getSymbolRecord(), "variable"===e.keyword)))return a.next(),a.addCommand({domain:"json",keyword:"json",lino:b,request:c,source:d,target:e.name}),!0;break;case "delete":d=a.nextToken();if(["property","element"].includes(d)&&(e=a.getNextValue(),["from","of"].includes(a.getToken())&&a.nextIsSymbol())){var f=a.getSymbolRecord();if("variable"===f.keyword)return a.next(),a.addCommand({domain:"json",keyword:"json",lino:b,request:c,what:d,value:e,target:f.name}),!0}break;case "rename":d=a.getNextValue();if(a.tokenIs("to")&& (e=a.getNextValue(),a.tokenIs("in")&&a.nextIsSymbol()&&(f=a.getSymbolRecord(),"variable"===f.keyword)))return a.next(),a.addCommand({domain:"json",keyword:"json",lino:b,request:c,oldName:d,newName:e,target:f.name}),!0;break;case "add":d=a.getNextValue();if(a.tokenIs("to")&&a.nextIsSymbol()&&(e=a.getSymbolRecord(),"variable"===e.keyword))return a.next(),a.addCommand({domain:"json",keyword:"json",lino:b,request:c,item:d,target:e.name}),!0;break;case "split":d=a.getNextValue();e="\n";a.tokenIs("on")&& @@ -189,43 +189,44 @@ for(d=e.length-1;0e.length-1&&a.runtimeError(b.lino,"Index out of range"),e[d]=h,c.value[c.index].content= -JSON.stringify(e)}return b.pc+1}},getHandler:function(a){switch(a){case "json":return EasyCoder_Json.Json;default:return null}},run:function(a){var b=a[a.pc],c=EasyCoder_Json.getHandler(b.keyword);c||a.runtimeError(b.lino,"Unknown keyword '"+b.keyword+"' in 'json' package");return c.run(a)},value:{compile:function(a){a.tokenIs("the")&&a.next();if(a.tokenIs("json")){var b=a.nextToken();if(["size","count","keys"].includes(b)){if(a.skip("of"),a.isSymbol()){var c=a.getSymbolRecord();a.next();if(c.isVHolder)return{domain:"json", -type:b,name:c.name}}}else if("index"===b&&a.nextTokenIs("of")&&(c=a.getNextValue(),a.tokenIs("in")))return a=a.getNextValue(),{domain:"json",type:b,item:c,list:a}}return null},get:function(a,b){switch(b.type){case "size":case "count":b=a.getSymbolRecord(b.name);a=a.getValue(b.value[b.index]);try{var c=JSON.parse(a)}catch(e){c=[]}return{type:"constant",numeric:!0,content:c?c.length:0};case "keys":return b=a.getSymbolRecord(b.name),c=(a=a.getValue(b.value[b.index]))?JSON.stringify(Object.keys(JSON.parse(a)).sort()): -"[]",{type:"constant",numeric:!1,content:c};case "index":var d=a.getValue(b.item);c=JSON.parse(a.getValue(b.list)).findIndex(function(e){return e===d});return{type:"constant",numeric:!0,content:c}}}},condition:{compile:function(){},test:function(){}}},EasyCoder_Rest={name:"EasyCoder_Rest",Rest:{compile:function(a){var b=a.getLino();switch(a.nextToken()){case "path":var c=a.getNextValue();a.addCommand({domain:"rest",keyword:"rest",lino:b,request:"path",path:c});return!0;case "get":if(a.nextIsSymbol(!0)&& -(c=a.getSymbolRecord(),"variable"===c.keyword&&a.nextTokenIs("from"))){var d=a.getNextValue(),e=a.getPc();a.addCommand({domain:"rest",keyword:"rest",lino:b,request:"get",target:c.name,url:d,onError:null});a.tokenIs("or")&&(a.next(),a.getCommandAt(e).onError=a.getPc()+1,a.completeHandler());return!0}break;case "post":c=null;if(a.nextTokenIs("to"))a.next();else if(c=a.getValue(),a.tokenIs("to"))a.next();else break;d=a.getValue();if(!d)throw Error(command.lino,"No URL present");e=null;if(a.tokenIs("giving")&& -a.nextIsSymbol())if(e=a.getSymbolRecord(),e.isVHolder)e=e.name,a.next();else throw Error("'"+e.name+"' cannot hold a value");a.addCommand({domain:"rest",keyword:"rest",lino:b,request:"post",value:c,url:d,target:e,onError:a.getPc()+2});onError=null;a.tokenIs("or")&&(a.next(),a.completeHandler());return!0}return!1},createCORSRequest:function(a,b){var c=new XMLHttpRequest;"withCredentials"in c?c.open(a,b,!0):"undefined"!=typeof XDomainRequest?(c=new XDomainRequest,c.open(a,b)):c=null;return c},run:function(a){var b= -a[a.pc];if("path"==b.request)return EasyCoder_Rest.restPath=a.getValue(b.path),b.pc+1;var c=a.getValue(b.url);EasyCoder_Rest.restPath||(EasyCoder_Rest.restPath="/wp-content/plugins/easycoder/rest.php");var d=c;c.startsWith("http")||(d="/"==c[0]?c.substr(1):EasyCoder_Rest.restPath+"/"+c);var e=EasyCoder_Rest.Rest.createCORSRequest(b.request,d);if(e){e.script=a.script;e.pc=a.pc;e.onload=function(){var f=EasyCoder.scripts[e.script],g=f[e.pc];if(200<=e.status&&400>e.status){var h=e.responseText.trim(); -if(g.target){var k=a.getSymbolRecord(b.target);k.value[k.index]={type:"constant",numeric:!1,content:h};k.used=!0}f.run(g.pc+1)}else h=e.status+" "+e.statusText,g.onError?(f.errorMessage="Exception trapped: "+h,f.run(g.onError)):f.runtimeError(g.lino,"Error: "+h)};e.onerror=function(){b.onError?(a.errorMessage=this.responseText,a.run(b.onError)):a.runtimeError(b.lino,this.responseText)};switch(b.request){case "get":e.send();break;case "post":c=a.getValue(b.value),console.log("POST to "+d),e.setRequestHeader("Content-type", -"application/json; charset=UTF-8"),e.send(c)}return 0}a.runtimeError(b.lino,"CORS not supported")}},getHandler:function(a){switch(a){case "rest":return EasyCoder_Rest.Rest;default:return null}},run:function(a){var b=a[a.pc],c=EasyCoder_Rest.getHandler(b.keyword);c||a.runtimeError(b.lino,"Unknown keyword '"+b.keyword+"' in 'rest' package");return c.run(a)},value:{compile:function(){return null},get:function(){return null}},condition:{compile:function(){},test:function(){}}},EasyCoder_Compare=function(a, -b,c){b=a.value.evaluate(a,b);a=a.value.evaluate(a,c);c=b.content;var d=a.content;c&&b.numeric?a.numeric||(d=""===d||"-"===d||"undefined"===typeof d?0:parseInt(d)):(d&&a.numeric&&(d=d.toString()),"undefined"===typeof c&&(c=""),"undefined"===typeof d&&(d=""));return c>d?1:c')}l+= -"
"}h.innerHTML=k+" "+l;h.style.display="block";b.$jscomp$loop$prop$run$134=document.getElementById("easycoder-run-button");b.$jscomp$loop$prop$step$135=document.getElementById("easycoder-step-button");b.$jscomp$loop$prop$run$134.onclick=function(q){return function(){q.$jscomp$loop$prop$run$134.blur();a.tracing=!1;document.getElementById("easycoder-tracer-content").style.display="none";try{EasyCoder_Run.run(a,a.resume)}catch(u){var t="Error in run handler: "+u.message;console.log(t);alert(t)}}}(b); -b.$jscomp$loop$prop$step$135.onclick=function(q){return function(){console.log("step");q.$jscomp$loop$prop$step$135.blur();a.tracing=!0;document.getElementById("easycoder-tracer-content").style.display="block";try{a.run(a.resume)}catch(u){var t="Error in step handler: "+u.message;console.log(t);alert(t)}}}(b)}a.resume=a.pc;a.pc=0}break}b={$jscomp$loop$prop$run$134:b.$jscomp$loop$prop$run$134,$jscomp$loop$prop$step$135:b.$jscomp$loop$prop$step$135}}},exit:function(a){a.onExit&&a.run(a.onExit);var b= -a.parent,c=a.afterExit;delete EasyCoder.scripts[a.script];a.module&&delete a.module.program;Object.keys(a).forEach(function(d){delete a[d]});b&&c&&EasyCoder.scripts[b].run(c)}},EasyCoder_Compiler={name:"EasyCoder_Compiler",getTokens:function(){return this.tokens},addWarning:function(a){this.warnings.push(a)},warning:function(a){this.addWarning(a)},unrecognisedSymbol:function(a){this.addWarning("Unrecognised symbol '"+a+"'")},getWarnings:function(){return this.warnings},getIndex:function(){return this.index}, -next:function(a){this.index+=void 0===a?1:a},peek:function(){return this.tokens[this.index+1].token},more:function(){return this.index=this.tokens.length?null:this.tokens[this.index]?this.tokens[this.index].token:null},nextToken:function(){this.next();return this.getToken()},tokenIs:function(a){return this.index>=this.tokens.length?!1:a===this.tokens[this.index].token},nextTokenIs:function(a){this.next();return this.tokenIs(a)},skip:function(a){if(this.index>= -this.tokens.length)return null;this.next();this.tokenIs(a)&&this.next()},prev:function(){this.index--},getLino:function(){return this.index>=this.tokens.length?0:this.tokens[this.index].lino},getTarget:function(a){a=void 0===a?this.index:a;return this.tokens[a].token},getTargetPc:function(a){a=void 0===a?this.index:a;return this.symbols[this.getTarget(a)].pc},getCommandAt:function(a){return this.program[a]},isSymbol:function(a){a=void 0===a?!1:a;if(this.getTarget()in this.symbols)return!0;if(a)throw Error("Unknown symbol: '"+ -this.getTarget()+"'");return!1},nextIsSymbol:function(a){a=void 0===a?!1:a;this.next();return this.isSymbol(a)},getSymbol:function(a){if(this.isSymbol(void 0===a?!1:a))return this.symbols[this.getToken()]},getSymbolPc:function(a){return this.getSymbol(void 0===a?!1:a).pc},getSymbolRecord:function(){var a=this.program[this.getSymbolPc(!0)];a.used=!0;return a},getSymbols:function(){return this.symbols},getProgram:function(){return this.program},getPc:function(){return this.program.length},getValue:function(){return this.value.compile(this)}, -getNextValue:function(){this.next();return this.getValue()},getCondition:function(){return this.condition.compile(this)},constant:function(a,b){return this.value.constant(a,void 0===b?!1:b)},addCommand:function(a){a.pc=this.program.length;this.program.push(a)},addSymbol:function(a,b){this.symbols[a]={pc:b}},mark:function(){this.savedMark=this.index},rewind:function(){this.index=this.savedMark},rewindTo:function(a){this.index=a},completeHandler:function(){var a=this.getLino(),b=this.getPc();this.addCommand({domain:"core", -keyword:"goto",lino:a,goto:0});this.compileOne();this.continue?(this.addCommand({domain:"core",keyword:"goto",lino:a,goto:this.getPc()+1}),this.continue=!1):this.addCommand({domain:"core",keyword:"stop",lino:a,next:0});this.getCommandAt(b).goto=this.getPc();return!0},compileVariable:function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?null:d;this.next();var e=this.getLino(),f=this.getTokens()[this.getIndex()];if(this.symbols[f.token])throw Error("Duplicate variable name '"+f.token+"'");var g=this.getPc(); -this.next();this.addSymbol(f.token,g);a={domain:a,keyword:b,lino:e,isSymbol:!0,used:!1,isVHolder:c,name:f.token,elements:1,index:0,value:[{}],element:[],extra:d};"dom"===d&&(a.element=[]);this.addCommand(a);return a},compileToken:function(){var a=this.getToken();if(a){this.mark();for(var b=$jscomp.makeIterator(Object.keys(this.domain)),c=b.next();!c.done;c=b.next()){if((c=this.domain[c.value])&&(c=c.getHandler(a))&&c.compile(this))return;this.rewind()}console.log("No handler found");throw Error("I don't understand '"+ -a+"...'");}},compileOne:function(){var a=this.getToken();if(a){this.warnings=[];var b=this.program.length;if(a.endsWith(":")){a=a.substring(0,a.length-1);if(this.symbols[a])throw Error("Duplicate symbol: '"+a+"'");this.symbols[a]={pc:b};this.index++}else this.compileToken()}},compileFromHere:function(a){for(;this.indexf?0:f;fe.status){var h=e.responseText.trim();if(g.target){var k=a.getSymbolRecord(b.target);k.value[k.index]={type:"constant",numeric:!1,content:h};k.used=!0}f.run(g.pc+1)}else h=e.status+" "+e.statusText,g.onError?(f.errorMessage="Exception trapped: "+ +h,f.run(g.onError)):f.runtimeError(g.lino,"Error: "+h)};e.onerror=function(){b.onError?(a.errorMessage=this.responseText,a.run(b.onError)):a.runtimeError(b.lino,this.responseText)};switch(b.request){case "get":e.send();break;case "post":c=a.getValue(b.value),console.log("POST to "+d),e.setRequestHeader("Content-type","application/json; charset=UTF-8"),e.send(c)}return 0}a.runtimeError(b.lino,"CORS not supported")}},getHandler:function(a){switch(a){case "rest":return EasyCoder_Rest.Rest;default:return null}}, +run:function(a){var b=a[a.pc],c=EasyCoder_Rest.getHandler(b.keyword);c||a.runtimeError(b.lino,"Unknown keyword '"+b.keyword+"' in 'rest' package");return c.run(a)},value:{compile:function(){return null},get:function(){return null}},condition:{compile:function(){},test:function(){}}},EasyCoder_Compare=function(a,b,c){b=a.value.evaluate(a,b);a=a.value.evaluate(a,c);c=b.content;var d=a.content;c&&b.numeric?a.numeric||(d=""===d||"-"===d||"undefined"===typeof d?0:parseInt(d)):(d&&a.numeric&&(d=d.toString()), +"undefined"===typeof c&&(c=""),"undefined"===typeof d&&(d=""));return c>d?1:c')}l+="
"}h.innerHTML=k+" "+l;h.style.display="block";b.$jscomp$loop$prop$run$135=document.getElementById("easycoder-run-button");b.$jscomp$loop$prop$step$136=document.getElementById("easycoder-step-button"); +b.$jscomp$loop$prop$run$135.onclick=function(q){return function(){q.$jscomp$loop$prop$run$135.blur();a.tracing=!1;document.getElementById("easycoder-tracer-content").style.display="none";try{EasyCoder_Run.run(a,a.resume)}catch(u){var t="Error in run handler: "+u.message;console.log(t);alert(t)}}}(b);b.$jscomp$loop$prop$step$136.onclick=function(q){return function(){console.log("step");q.$jscomp$loop$prop$step$136.blur();a.tracing=!0;document.getElementById("easycoder-tracer-content").style.display= +"block";try{a.run(a.resume)}catch(u){var t="Error in step handler: "+u.message;console.log(t);alert(t)}}}(b)}a.resume=a.pc;a.pc=0}break}b={$jscomp$loop$prop$run$135:b.$jscomp$loop$prop$run$135,$jscomp$loop$prop$step$136:b.$jscomp$loop$prop$step$136}}},exit:function(a){a.onExit&&a.run(a.onExit);var b=a.parent,c=a.afterExit;delete EasyCoder.scripts[a.script];a.module&&delete a.module.program;Object.keys(a).forEach(function(d){delete a[d]});b&&c&&EasyCoder.scripts[b].run(c)}},EasyCoder_Compiler={name:"EasyCoder_Compiler", +getTokens:function(){return this.tokens},addWarning:function(a){this.warnings.push(a)},warning:function(a){this.addWarning(a)},unrecognisedSymbol:function(a){this.addWarning("Unrecognised symbol '"+a+"'")},getWarnings:function(){return this.warnings},getIndex:function(){return this.index},next:function(a){this.index+=void 0===a?1:a},peek:function(){return this.tokens[this.index+1].token},more:function(){return this.index=this.tokens.length? +null:this.tokens[this.index]?this.tokens[this.index].token:null},nextToken:function(){this.next();return this.getToken()},tokenIs:function(a){return this.index>=this.tokens.length?!1:a===this.tokens[this.index].token},nextTokenIs:function(a){this.next();return this.tokenIs(a)},skip:function(a){if(this.index>=this.tokens.length)return null;this.next();this.tokenIs(a)&&this.next()},prev:function(){this.index--},getLino:function(){return this.index>=this.tokens.length?0:this.tokens[this.index].lino}, +getTarget:function(a){a=void 0===a?this.index:a;return this.tokens[a].token},getTargetPc:function(a){a=void 0===a?this.index:a;return this.symbols[this.getTarget(a)].pc},getCommandAt:function(a){return this.program[a]},isSymbol:function(a){a=void 0===a?!1:a;if(this.getTarget()in this.symbols)return!0;if(a)throw Error("Unknown symbol: '"+this.getTarget()+"'");return!1},nextIsSymbol:function(a){a=void 0===a?!1:a;this.next();return this.isSymbol(a)},getSymbol:function(a){if(this.isSymbol(void 0===a? +!1:a))return this.symbols[this.getToken()]},getSymbolPc:function(a){return this.getSymbol(void 0===a?!1:a).pc},getSymbolRecord:function(){var a=this.program[this.getSymbolPc(!0)];a.used=!0;return a},getSymbols:function(){return this.symbols},getProgram:function(){return this.program},getPc:function(){return this.program.length},getValue:function(){return this.value.compile(this)},getNextValue:function(){this.next();return this.getValue()},getCondition:function(){return this.condition.compile(this)}, +constant:function(a,b){return this.value.constant(a,void 0===b?!1:b)},addCommand:function(a){a.pc=this.program.length;this.program.push(a)},addSymbol:function(a,b){this.symbols[a]={pc:b}},mark:function(){this.savedMark=this.index},rewind:function(){this.index=this.savedMark},rewindTo:function(a){this.index=a},completeHandler:function(){var a=this.getLino(),b=this.getPc();this.addCommand({domain:"core",keyword:"goto",lino:a,goto:0});this.compileOne();this.continue?(this.addCommand({domain:"core",keyword:"goto", +lino:a,goto:this.getPc()+1}),this.continue=!1):this.addCommand({domain:"core",keyword:"stop",lino:a,next:0});this.getCommandAt(b).goto=this.getPc();return!0},compileVariable:function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?null:d;this.next();var e=this.getLino(),f=this.getTokens()[this.getIndex()];if(this.symbols[f.token])throw Error("Duplicate variable name '"+f.token+"'");var g=this.getPc();this.next();this.addSymbol(f.token,g);a={domain:a,keyword:b,lino:e,isSymbol:!0,used:!1,isVHolder:c,name:f.token, +elements:1,index:0,value:[{}],element:[],extra:d};"dom"===d&&(a.element=[]);this.addCommand(a);return a},compileToken:function(){var a=this.getToken();if(a){this.mark();for(var b=$jscomp.makeIterator(Object.keys(this.domain)),c=b.next();!c.done;c=b.next()){if((c=this.domain[c.value])&&(c=c.getHandler(a))&&c.compile(this))return;this.rewind()}console.log("No handler found");throw Error("I don't understand '"+a+"...'");}},compileOne:function(){var a=this.getToken();if(a){this.warnings=[];var b=this.program.length; +if(a.endsWith(":")){a=a.substring(0,a.length-1);if(this.symbols[a])throw Error("Duplicate symbol: '"+a+"'");this.symbols[a]={pc:b};this.index++}else this.compileToken()}},compileFromHere:function(a){for(;this.indexf?0:f;f~%0a~m:  "protocol":"https://",
~%0a~m:  "domain":"easycoder.software",
~%0a~m:  "path":"demos/first",
~%0a~m:  "arg":"value=56"
~%0a~m:}~%0a%0aSee also ~l:history|k|browser!history~ for managing the browser history","examples":"json parse url `https://easycoder.software/demos/first/?value=56` as ParsedValue"},"json rename":{"syntax":"json rename {property} to {new name} in {object}","description":"This renames a property in a JSON object.","examples":"json rename `mail` to `email` in Details"},"json sort":{"syntax":"json sort {list}","description":"Sorts the contents of a list into ascending alphabetical order.","examples":"json sort MyList"},"json split":{"syntax":"json split {item} [on {separator}] into {variable}","description":"Splits a variable into an array of parts on the given separator. If no separator is given the separator is set to a newline (%0a).","examples":"json split Paragraph into Lines%0ajson split Text on `~` into Tokens"}},"values":{"":{"syntax":"","description":"","examples":""},"json keys":{"syntax":"[the] json keys of {object}","description":"Returns the keys of all the properties in the JSON object as a JSON array.","examples":"put the json keys of PersonalDetails into MyArray"},"json count":{"syntax":"[the] json count of {array}","description":"Returns the number of elements in the specified array. See also ~l:json size~, which does the same thing.","examples":"put the json count of Rows into NRows"},"json size":{"syntax":"[the] json size of {array}","description":"Returns the number of elements in the specified array. See also ~l:json count~, which does the same thing.","examples":"put the json size of Rows into NRows"},"json index":{"syntax":"[the] json index of {item} in {array}","description":"Returns the zero-based index of the element in the array, or -1 if it is not present.","examples":"put the json index of `August` in Months into Index"}},"conditions":"{}"} \ No newline at end of file +{"commands":{"json shuffle":{"syntax":"json shuffle {list}","description":"Shuffles the contents of a list into random order.","examples":"json shuffle MyList"},"json add":{"syntax":"json add {item} to {array}","description":"This adds an element to a JSON array.","examples":"json add `Egypt` to Countries"},"json delete":{"syntax":"json delete property {name} from/of {object}%0ajson delete element {index} from/of {array}","description":"This deletes the named property, or the element at a specific index, from the JSON array given.","examples":"json delete property `name` from PersonalDetails%0ajson delete element 5 of TheArray"},"json format":{"syntax":"json format {item}","description":"~m:json format~ deals with badly-formatted JSON strings that contain redundant spacing and line breaks. It uses the internal ~m:JSON.parse~ and ~m:JSON.stringify~ to get the item into a standard format.","examples":"json format MyData"},"json parse":{"syntax":"json parse url {url} as {variable}","description":"This parses a URL, splitting it up into its component parts so they can be easily worked on. In the example above these parts are:%0a%0a~m:protocol~: The protocol: ~m:https://~%0a%0a~m:domain~: The domain: ~m:easycoder.software~%0a%0a~m:path~: The path: ~demos/first~%0a%0a~m:arg~: The CGI parameters: ~value=56~%0a%0aHere, the result in ~m:ParsedValue~ would be%0a%0a~m:{
~%0a~m:  "protocol":"https://",
~%0a~m:  "domain":"easycoder.software",
~%0a~m:  "path":"demos/first",
~%0a~m:  "arg":"value=56"
~%0a~m:}~%0a%0aSee also ~l:history|k|browser!history~ for managing the browser history","examples":"json parse url `https://easycoder.software/demos/first/?value=56` as ParsedValue"},"json rename":{"syntax":"json rename {property} to {new name} in {object}","description":"This renames a property in a JSON object.","examples":"json rename `mail` to `email` in Details"},"json sort":{"syntax":"json sort {list}","description":"Sorts the contents of a list into ascending alphabetical order.","examples":"json sort MyList"},"json split":{"syntax":"json split {item} [on {separator}] into {variable}","description":"Splits a variable into an array of parts on the given separator. If no separator is given the separator is set to a newline (%0a).","examples":"json split Paragraph into Lines%0ajson split Text on `~` into Tokens"}},"values":{"":{"syntax":"","description":"","examples":""},"json keys":{"syntax":"[the] json keys [unsorted] of {object}","description":"Returns the keys of all the properties in the JSON object as a JSON array; by default sorted alphabetically. If ~m:unsorted~ is given the list will be unsorted.","examples":"put the json keys of PersonalDetails into MyArray%0aput the json keys unsorted of List into Keys"},"json count":{"syntax":"[the] json count of {array}","description":"Returns the number of elements in the specified array. See also ~l:json size~, which does the same thing.","examples":"put the json count of Rows into NRows"},"json size":{"syntax":"[the] json size of {array}","description":"Returns the number of elements in the specified array. See also ~l:json count~, which does the same thing.","examples":"put the json size of Rows into NRows"},"json index":{"syntax":"[the] json index of {item} in {array}","description":"Returns the zero-based index of the element in the array, or -1 if it is not present.","examples":"put the json index of `August` in Months into Index"}},"conditions":"{}"} \ No newline at end of file