Added node modules

This commit is contained in:
John Crepezzi 2012-02-06 14:09:01 -05:00
parent ca9d4c18f7
commit d1e0644a4e
575 changed files with 77900 additions and 6 deletions

View file

@ -0,0 +1 @@
[],Array(1),[1,2,3]

View file

@ -0,0 +1 @@
(function(){var a=function(){};return new a(1,2,3,4)})()

View file

@ -0,0 +1 @@
(function(){function a(){}return new a(1,2,3,4)})()

View file

@ -0,0 +1 @@
(function(){function a(){}(function(){return new a(1,2,3)})()})()

View file

@ -0,0 +1 @@
a=1,b=a,c=1,d=b,e=d,longname=2;if(longname+1){x=3;if(x)var z=7}z=1,y=1,x=1,g+=1,h=g,++i,j=i,i++,j=i+17

View file

@ -0,0 +1 @@
var a=a+"a"+"b"+1+c,b=a+"c"+"ds"+123+c,c=a+"c"+123+d+"ds"+c

View file

@ -0,0 +1 @@
var a=13,b=1/3

View file

@ -0,0 +1 @@
function bar(){return--x}function foo(){while(bar());}function mak(){for(;;);}var x=5

View file

@ -0,0 +1 @@
a=func(),b=z;for(a++;i<10;i++)alert(i);var z=1;g=2;for(;i<10;i++)alert(i);var a=2;for(var i=1;i<10;i++)alert(i)

View file

@ -0,0 +1 @@
var a=1;a==1?a=2:a=17

View file

@ -0,0 +1 @@
function a(a){return a==1?2:17}

View file

@ -0,0 +1 @@
function x(a){return typeof a=="object"?a:a===42?0:a*2}function y(a){return typeof a=="object"?a:null}

View file

@ -0,0 +1 @@
function f(){var a;return(a="a")?a:a}f()

View file

@ -0,0 +1 @@
new(A,B),new(A||B),new(X?A:B)

View file

@ -0,0 +1 @@
var a=/^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#])(?::(\d))?)?(..?$|(?:[^?#\/]\/))([^?#]*)(?:\?([^#]))?(?:#(.))?/

View file

@ -0,0 +1 @@
var a={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}

View file

@ -0,0 +1 @@
var a=3250441966

View file

@ -0,0 +1 @@
var a=function(b){b(),a()}

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
var a=0;switch(a){case 0:a++}

View file

@ -0,0 +1 @@
a:break a;console.log(1)

View file

@ -0,0 +1 @@
(a?b:c)?d:e

View file

@ -0,0 +1 @@
if(!x)debugger

View file

@ -0,0 +1 @@
o={".5":.5},o={.5:.5},o={.5:.5}

View file

@ -0,0 +1 @@
result=function(){return 1}()

View file

@ -0,0 +1 @@
var a=8,b=4,c=4

View file

@ -0,0 +1 @@
var a={};a["this"]=1,a.that=2

View file

@ -0,0 +1 @@
var a=2e3,b=.002,c=2e-5

View file

@ -0,0 +1 @@
var s,i;s="",i=0

View file

@ -0,0 +1 @@
function bar(a){try{foo()}catch(b){alert("Exception caught (foo not defined)")}alert(a)}bar(10)

View file

@ -0,0 +1 @@
x=(y,z)

View file

@ -0,0 +1 @@
foo+"",a.toString(16),b.toString.call(c)

View file

@ -0,0 +1 @@
function f(){function b(){}if(a)return;b()}

View file

@ -0,0 +1 @@
[(a,b)]

View file

@ -0,0 +1 @@
var a={a:1,b:2}

View file

@ -0,0 +1 @@
(function(){var a=function b(a,b,c){return b}})()

View file

@ -0,0 +1 @@
var nullString="\0"

View file

@ -0,0 +1 @@
typeof a=="string",b+""!=c+"",d<e==f<g

View file

@ -0,0 +1 @@
var a=1,b=2

View file

@ -0,0 +1 @@
function id(a){return a}

View file

@ -0,0 +1 @@
with({});

View file

@ -0,0 +1,3 @@
new Array();
new Array(1);
new Array(1, 2, 3);

View file

@ -0,0 +1,4 @@
(function(){
var Array = function(){};
return new Array(1, 2, 3, 4);
})();

View file

@ -0,0 +1,4 @@
(function(){
return new Array(1, 2, 3, 4);
function Array() {};
})();

View file

@ -0,0 +1,6 @@
(function(){
(function(){
return new Array(1, 2, 3);
})();
function Array(){};
})();

View file

@ -0,0 +1,20 @@
a=1;
b=a;
c=1;
d=b;
e=d;
longname=2;
if (longname+1) {
x=3;
if (x) var z = 7;
}
z=1,y=1,x=1
g+=1;
h=g;
++i;
j=i;
i++;
j=i+17;

View file

@ -0,0 +1,3 @@
var a = a + "a" + "b" + 1 + c;
var b = a + "c" + "ds" + 123 + c;
var c = a + "c" + 123 + d + "ds" + c;

View file

@ -0,0 +1,5 @@
// test that the calculation is fold to 13
var a = 1 + 2 * 6;
// test that it isn't replaced with 0.3333 because that is more characters
var b = 1/3;

View file

@ -0,0 +1,4 @@
var x = 5;
function bar() { return --x; }
function foo() { while (bar()); }
function mak() { for(;;); }

View file

@ -0,0 +1,10 @@
a=func();
b=z;
for (a++; i < 10; i++) { alert(i); }
var z=1;
g=2;
for (; i < 10; i++) { alert(i); }
var a = 2;
for (var i = 1; i < 10; i++) { alert(i); }

6
node_modules/uglify-js/test/unit/compress/test/if.js generated vendored Normal file
View file

@ -0,0 +1,6 @@
var a = 1;
if (a == 1) {
a = 2;
} else {
a = 17;
}

View file

@ -0,0 +1,9 @@
function a(b) {
if (b == 1) {
return 2;
} else {
return 17;
}
return 3;
}

View file

@ -0,0 +1,16 @@
function x(a) {
if (typeof a === 'object')
return a;
if (a === 42)
return 0;
return a * 2;
}
function y(a) {
if (typeof a === 'object')
return a;
return null;
};

View file

@ -0,0 +1 @@
function f() { var a; if (a = 'a') { return a; } else { return a; } }; f();

View file

@ -0,0 +1,3 @@
new (A, B)
new (A || B)
new (X ? A : B)

View file

@ -0,0 +1 @@
var a = /^(?:(\w+):)?(?:\/\/(?:(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#])(?::(\d))?)?(..?$|(?:[^?#\/]\/))([^?#]*)(?:\?([^#]))?(?:#(.))?/;

View file

@ -0,0 +1 @@
var a = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};

View file

@ -0,0 +1 @@
var a = 0xC1BDCEEE;

View file

@ -0,0 +1,4 @@
var a = function(b) {
b();
a()
}

View file

@ -0,0 +1 @@
{a: 1}

View file

@ -0,0 +1,6 @@
var a = 0;
switch(a) {
case 0:
a++;
break;
}

View file

@ -0,0 +1,7 @@
label1 : {
label2 : {
break label2;
console.log(2);
}
console.log(1);
}

View file

@ -0,0 +1 @@
(a ? b : c) ? d : e

View file

@ -0,0 +1 @@
if (!x) debugger;

View file

@ -0,0 +1,3 @@
o = {'.5':.5}
o = {'0.5':.5}
o = {0.5:.5}

View file

@ -0,0 +1 @@
result=(function(){ return 1;})()

View file

@ -0,0 +1,3 @@
var a = 1 << 3;
var b = 8 >> 1;
var c = 8 >>> 1;

View file

@ -0,0 +1,3 @@
var a = {};
a["this"] = 1;
a["that"] = 2;

View file

@ -0,0 +1,3 @@
var a = 2e3;
var b = 2e-3;
var c = 2e-5;

View file

@ -0,0 +1 @@
var s, i; s = ''; i = 0;

View file

@ -0,0 +1,9 @@
function bar(a) {
try {
foo();
} catch(e) {
alert("Exception caught (foo not defined)");
}
alert(a); // 10 in FF, "[object Error]" in IE
}
bar(10);

View file

@ -0,0 +1 @@
x = (y, z)

View file

@ -0,0 +1,3 @@
foo.toString();
a.toString(16);
b.toString.call(c);

View file

@ -0,0 +1,5 @@
function f() {
if (a) return;
g();
function g(){}
};

View file

@ -0,0 +1 @@
[(a,b)]

View file

@ -0,0 +1,4 @@
var a = {
a: 1,
b: 2, // <-- trailing comma
};

View file

@ -0,0 +1,5 @@
(function() {
var x = function fun(a, fun, b) {
return fun;
};
}());

View file

@ -0,0 +1 @@
var nullString = "\0"

View file

@ -0,0 +1,3 @@
typeof a === 'string'
b + "" !== c + ""
d < e === f < g

View file

@ -0,0 +1,3 @@
// var declarations after each other should be combined
var a = 1;
var b = 2;

View file

@ -0,0 +1,21 @@
function id(a) {
// Form-Feed
// Vertical Tab
// No-Break Space
// Mongolian Vowel Separator
// En quad
// Em quad
// En space
// Em space
// Three-Per-Em Space
// Four-Per-Em Space
// Six-Per-Em Space
// Figure Space
// Punctuation Space
// Thin Space
// Hair Space
// Narrow No-Break Space
// Medium Mathematical Space
 // Ideographic Space
return a;
}

View file

@ -0,0 +1,2 @@
with({}) {
};

55
node_modules/uglify-js/test/unit/scripts.js generated vendored Normal file
View file

@ -0,0 +1,55 @@
var fs = require('fs'),
uglify = require('../../uglify-js'),
jsp = uglify.parser,
nodeunit = require('nodeunit'),
path = require('path'),
pro = uglify.uglify;
var Script = process.binding('evals').Script;
var scriptsPath = __dirname;
function compress(code) {
var ast = jsp.parse(code);
ast = pro.ast_mangle(ast);
ast = pro.ast_squeeze(ast, { no_warnings: true });
ast = pro.ast_squeeze_more(ast);
return pro.gen_code(ast);
};
var testDir = path.join(scriptsPath, "compress", "test");
var expectedDir = path.join(scriptsPath, "compress", "expected");
function getTester(script) {
return function(test) {
var testPath = path.join(testDir, script);
var expectedPath = path.join(expectedDir, script);
var content = fs.readFileSync(testPath, 'utf-8');
var outputCompress = compress(content);
// Check if the noncompressdata is larger or same size as the compressed data
test.ok(content.length >= outputCompress.length);
// Check that a recompress gives the same result
var outputReCompress = compress(content);
test.equal(outputCompress, outputReCompress);
// Check if the compressed output is what is expected
var expected = fs.readFileSync(expectedPath, 'utf-8');
test.equal(outputCompress, expected.replace(/(\r?\n)+$/, ""));
test.done();
};
};
var tests = {};
var scripts = fs.readdirSync(testDir);
for (var i in scripts) {
var script = scripts[i];
if (/\.js$/.test(script)) {
tests[script] = getTester(script);
}
}
module.exports = nodeunit.testCase(tests);