public
Last active

JSDev examples

  • Download Gist
01
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Example 1:
 
Input:
/*myname
console.log('what what');
*/
Compiled with:
jsdev < test.js myname
Outputs:
{ console.log('what what'); }
02
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
Example 2:
 
Input:
/*myname
 
var numIsNaN = function(v){
if(typeof v !== 'number' || isNaN(v)){
throw new TypeError('NaN: ' + v);
}
return v;
};
*/
 
function Vector(x, y){
/*vecNaN x*/
/*vecNaN y*/
 
this.x = x;
this.y = y;
}
Compiled with:
jsdev < test.js myname vecNaN:numIsNaN
Outputs:
{ var numIsNaN = function(v){
if(typeof v !== 'number' || isNaN(v)){
throw new TypeError('NaN: ' + v);
}
return v;
};}
 
function Vector(x, y){
{numIsNaN(x);}
{numIsNaN(y);}
 
this.x = x;
this.y = y;
}
03
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Example 3:
 
Input:
 
function Vector(x, y){
/*nonZero(x === 0) 'x was zero'*/
/*nonZero(y === 0) 'y was zero'*/
 
this.x = x;
this.y = y;
}
 
Compiled with:
jsdev < test.js myname nonZero:alert
Outputs:
 
function Vector(x, y){
{if(x === 0) alert('x was zero');}
{if(y === 0) alert('y was zero');}
 
this.x = x;
this.y = y;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.