Skip to content

Instantly share code, notes, and snippets.

@kirbysayshi
Created January 31, 2012 19:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kirbysayshi/1712319 to your computer and use it in GitHub Desktop.
Save kirbysayshi/1712319 to your computer and use it in GitHub Desktop.
JSDev examples
Example 1:
Input:
/*myname
console.log('what what');
*/
Compiled with:
jsdev < test.js myname
Outputs:
{ console.log('what what'); }
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;
}
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment