uglifier 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of uglifier might be problematic. Click here for more details.

Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/es5.js +75 -0
  3. data/uglifier.gemspec +9 -8
  4. metadata +13 -28
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
data/lib/es5.js CHANGED
@@ -23,6 +23,81 @@ if (!Array.prototype.forEach)
23
23
  };
24
24
  }
25
25
 
26
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
27
+ // Production steps of ECMA-262, Edition 5, 15.4.4.19
28
+ // Reference: http://es5.github.com/#x15.4.4.19
29
+ if (!Array.prototype.map) {
30
+ Array.prototype.map = function(callback, thisArg) {
31
+
32
+ var T, A, k;
33
+
34
+ if (this == null) {
35
+ throw new TypeError(" this is null or not defined");
36
+ }
37
+
38
+ // 1. Let O be the result of calling ToObject passing the |this| value as the argument.
39
+ var O = Object(this);
40
+
41
+ // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
42
+ // 3. Let len be ToUint32(lenValue).
43
+ var len = O.length >>> 0;
44
+
45
+ // 4. If IsCallable(callback) is false, throw a TypeError exception.
46
+ // See: http://es5.github.com/#x9.11
47
+ if ({}.toString.call(callback) != "[object Function]") {
48
+ throw new TypeError(callback + " is not a function");
49
+ }
50
+
51
+ // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
52
+ if (thisArg) {
53
+ T = thisArg;
54
+ }
55
+
56
+ // 6. Let A be a new array created as if by the expression new Array(len) where Array is
57
+ // the standard built-in constructor with that name and len is the value of len.
58
+ A = new Array(len);
59
+
60
+ // 7. Let k be 0
61
+ k = 0;
62
+
63
+ // 8. Repeat, while k < len
64
+ while(k < len) {
65
+
66
+ var kValue, mappedValue;
67
+
68
+ // a. Let Pk be ToString(k).
69
+ // This is implicit for LHS operands of the in operator
70
+ // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
71
+ // This step can be combined with c
72
+ // c. If kPresent is true, then
73
+ if (k in O) {
74
+
75
+ // i. Let kValue be the result of calling the Get internal method of O with argument Pk.
76
+ kValue = O[ k ];
77
+
78
+ // ii. Let mappedValue be the result of calling the Call internal method of callback
79
+ // with T as the this value and argument list containing kValue, k, and O.
80
+ mappedValue = callback.call(T, kValue, k, O);
81
+
82
+ // iii. Call the DefineOwnProperty internal method of A with arguments
83
+ // Pk, Property Descriptor {Value: mappedValue, Writable: true, Enumerable: true, Configurable: true},
84
+ // and false.
85
+
86
+ // In browsers that support Object.defineProperty, use the following:
87
+ // Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true });
88
+
89
+ // For best browser support, use the following:
90
+ A[ k ] = mappedValue;
91
+ }
92
+ // d. Increase k by 1.
93
+ k++;
94
+ }
95
+
96
+ // 9. return A
97
+ return A;
98
+ };
99
+ }
100
+
26
101
  // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/Reduce
27
102
 
28
103
  if (!Array.prototype.reduce)
data/uglifier.gemspec CHANGED
@@ -4,13 +4,13 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "uglifier"
8
- s.version = "1.0.2"
7
+ s.name = %q{uglifier}
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ville Lautanala"]
12
- s.date = "2011-08-28"
13
- s.email = "lautis@gmail.com"
12
+ s.date = %q{2011-09-05}
13
+ s.email = %q{lautis@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
16
16
  "README.rdoc"
@@ -33,15 +33,16 @@ Gem::Specification.new do |s|
33
33
  "spec/uglifier_spec.rb",
34
34
  "uglifier.gemspec"
35
35
  ]
36
- s.homepage = "http://github.com/lautis/uglifier"
36
+ s.homepage = %q{http://github.com/lautis/uglifier}
37
37
  s.require_paths = ["lib"]
38
- s.rubygems_version = "1.8.10"
39
- s.summary = "Ruby wrapper for UglifyJS JavaScript compressor"
38
+ s.rubygems_version = %q{1.3.6}
39
+ s.summary = %q{Ruby wrapper for UglifyJS JavaScript compressor}
40
40
 
41
41
  if s.respond_to? :specification_version then
42
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
42
43
  s.specification_version = 3
43
44
 
44
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
45
46
  s.add_runtime_dependency(%q<execjs>, [">= 0.3.0"])
46
47
  s.add_runtime_dependency(%q<multi_json>, [">= 1.0.2"])
47
48
  s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uglifier
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 0
9
- - 2
10
- version: 1.0.2
8
+ - 3
9
+ version: 1.0.3
11
10
  platform: ruby
12
11
  authors:
13
12
  - Ville Lautanala
@@ -15,102 +14,91 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-08-28 00:00:00 Z
17
+ date: 2011-09-05 00:00:00 +03:00
18
+ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- hash: 19
27
25
  segments:
28
26
  - 0
29
27
  - 3
30
28
  - 0
31
29
  version: 0.3.0
30
+ requirement: *id001
32
31
  name: execjs
33
32
  prerelease: false
34
33
  type: :runtime
35
- requirement: *id001
36
34
  - !ruby/object:Gem::Dependency
37
35
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
36
  requirements:
40
37
  - - ">="
41
38
  - !ruby/object:Gem::Version
42
- hash: 19
43
39
  segments:
44
40
  - 1
45
41
  - 0
46
42
  - 2
47
43
  version: 1.0.2
44
+ requirement: *id002
48
45
  name: multi_json
49
46
  prerelease: false
50
47
  type: :runtime
51
- requirement: *id002
52
48
  - !ruby/object:Gem::Dependency
53
49
  version_requirements: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
50
  requirements:
56
51
  - - ~>
57
52
  - !ruby/object:Gem::Version
58
- hash: 23
59
53
  segments:
60
54
  - 2
61
55
  - 6
62
56
  - 0
63
57
  version: 2.6.0
58
+ requirement: *id003
64
59
  name: rspec
65
60
  prerelease: false
66
61
  type: :development
67
- requirement: *id003
68
62
  - !ruby/object:Gem::Dependency
69
63
  version_requirements: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
64
  requirements:
72
65
  - - ~>
73
66
  - !ruby/object:Gem::Version
74
- hash: 23
75
67
  segments:
76
68
  - 1
77
69
  - 0
78
70
  - 0
79
71
  version: 1.0.0
72
+ requirement: *id004
80
73
  name: bundler
81
74
  prerelease: false
82
75
  type: :development
83
- requirement: *id004
84
76
  - !ruby/object:Gem::Dependency
85
77
  version_requirements: &id005 !ruby/object:Gem::Requirement
86
- none: false
87
78
  requirements:
88
79
  - - ~>
89
80
  - !ruby/object:Gem::Version
90
- hash: 15
91
81
  segments:
92
82
  - 1
93
83
  - 6
94
84
  - 0
95
85
  version: 1.6.0
86
+ requirement: *id005
96
87
  name: jeweler
97
88
  prerelease: false
98
89
  type: :development
99
- requirement: *id005
100
90
  - !ruby/object:Gem::Dependency
101
91
  version_requirements: &id006 !ruby/object:Gem::Requirement
102
- none: false
103
92
  requirements:
104
93
  - - ">="
105
94
  - !ruby/object:Gem::Version
106
- hash: 3
107
95
  segments:
108
96
  - 0
109
97
  version: "0"
98
+ requirement: *id006
110
99
  name: rcov
111
100
  prerelease: false
112
101
  type: :development
113
- requirement: *id006
114
102
  description:
115
103
  email: lautis@gmail.com
116
104
  executables: []
@@ -137,6 +125,7 @@ files:
137
125
  - spec/spec_helper.rb
138
126
  - spec/uglifier_spec.rb
139
127
  - uglifier.gemspec
128
+ has_rdoc: true
140
129
  homepage: http://github.com/lautis/uglifier
141
130
  licenses: []
142
131
 
@@ -146,27 +135,23 @@ rdoc_options: []
146
135
  require_paths:
147
136
  - lib
148
137
  required_ruby_version: !ruby/object:Gem::Requirement
149
- none: false
150
138
  requirements:
151
139
  - - ">="
152
140
  - !ruby/object:Gem::Version
153
- hash: 3
154
141
  segments:
155
142
  - 0
156
143
  version: "0"
157
144
  required_rubygems_version: !ruby/object:Gem::Requirement
158
- none: false
159
145
  requirements:
160
146
  - - ">="
161
147
  - !ruby/object:Gem::Version
162
- hash: 3
163
148
  segments:
164
149
  - 0
165
150
  version: "0"
166
151
  requirements: []
167
152
 
168
153
  rubyforge_project:
169
- rubygems_version: 1.8.10
154
+ rubygems_version: 1.3.6
170
155
  signing_key:
171
156
  specification_version: 3
172
157
  summary: Ruby wrapper for UglifyJS JavaScript compressor