pdfjs-dist 2.0.943 → 2.4.456

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pdfjs-dist might be problematic. Click here for more details.

Files changed (192) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/README.md +4 -0
  3. package/bower.json +1 -1
  4. package/build/pdf.js +8286 -14230
  5. package/build/pdf.js.map +1 -1
  6. package/build/pdf.min.js +22 -1
  7. package/build/pdf.worker.entry.js +5 -3
  8. package/build/pdf.worker.js +25500 -26628
  9. package/build/pdf.worker.js.map +1 -1
  10. package/build/pdf.worker.min.js +22 -1
  11. package/es5/build/pdf.js +25473 -0
  12. package/es5/build/pdf.js.map +1 -0
  13. package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
  14. package/es5/build/pdf.worker.js +57878 -0
  15. package/es5/build/pdf.worker.js.map +1 -0
  16. package/es5/web/images/annotation-check.svg +11 -0
  17. package/es5/web/images/annotation-comment.svg +16 -0
  18. package/es5/web/images/annotation-help.svg +26 -0
  19. package/es5/web/images/annotation-insert.svg +10 -0
  20. package/es5/web/images/annotation-key.svg +11 -0
  21. package/es5/web/images/annotation-newparagraph.svg +11 -0
  22. package/es5/web/images/annotation-noicon.svg +7 -0
  23. package/es5/web/images/annotation-note.svg +42 -0
  24. package/es5/web/images/annotation-paragraph.svg +16 -0
  25. package/es5/web/images/loading-icon.gif +0 -0
  26. package/es5/web/images/shadow.png +0 -0
  27. package/es5/web/images/texture.png +0 -0
  28. package/es5/web/pdf_viewer.css +407 -0
  29. package/es5/web/pdf_viewer.js +7757 -0
  30. package/es5/web/pdf_viewer.js.map +1 -0
  31. package/image_decoders/pdf.image_decoders.js +2887 -4094
  32. package/image_decoders/pdf.image_decoders.js.map +1 -1
  33. package/image_decoders/pdf.image_decoders.min.js +22 -1
  34. package/lib/README.md +7 -0
  35. package/lib/core/annotation.js +855 -778
  36. package/lib/core/arithmetic_decoder.js +325 -311
  37. package/lib/core/bidi.js +117 -50
  38. package/lib/core/ccitt.js +251 -89
  39. package/lib/core/ccitt_stream.js +26 -16
  40. package/lib/core/cff_parser.js +525 -197
  41. package/lib/core/charsets.js +6 -5
  42. package/lib/core/chunked_stream.js +541 -406
  43. package/lib/core/cmap.js +368 -253
  44. package/lib/core/colorspace.js +781 -800
  45. package/lib/core/core_utils.js +152 -0
  46. package/lib/core/crypto.js +609 -422
  47. package/lib/core/document.js +649 -481
  48. package/lib/core/encodings.js +33 -24
  49. package/lib/core/evaluator.js +1471 -736
  50. package/lib/core/font_renderer.js +289 -149
  51. package/lib/core/fonts.js +1067 -413
  52. package/lib/core/function.js +517 -287
  53. package/lib/core/glyphlist.js +4529 -4527
  54. package/lib/core/image.js +232 -114
  55. package/lib/core/image_utils.js +94 -0
  56. package/lib/core/jbig2.js +711 -342
  57. package/lib/core/jbig2_stream.js +31 -19
  58. package/lib/core/jpeg_stream.js +151 -26
  59. package/lib/core/jpg.js +433 -181
  60. package/lib/core/jpx.js +551 -143
  61. package/lib/core/jpx_stream.js +40 -28
  62. package/lib/core/metrics.js +2931 -2931
  63. package/lib/core/murmurhash3.js +104 -97
  64. package/lib/core/obj.js +1561 -1053
  65. package/lib/core/operator_list.js +192 -64
  66. package/lib/core/parser.js +1162 -864
  67. package/lib/core/pattern.js +224 -75
  68. package/lib/core/pdf_manager.js +154 -285
  69. package/lib/core/primitives.js +145 -69
  70. package/lib/core/ps_parser.js +212 -162
  71. package/lib/core/standard_fonts.js +245 -244
  72. package/lib/core/stream.js +353 -81
  73. package/lib/core/type1_parser.js +218 -68
  74. package/lib/core/unicode.js +1682 -1655
  75. package/lib/core/worker.js +233 -302
  76. package/lib/core/worker_stream.js +168 -0
  77. package/lib/display/annotation_layer.js +808 -862
  78. package/lib/display/api.js +1778 -1462
  79. package/lib/display/api_compatibility.js +14 -9
  80. package/lib/display/canvas.js +463 -140
  81. package/lib/display/content_disposition.js +86 -58
  82. package/lib/display/display_utils.js +524 -0
  83. package/lib/display/fetch_stream.js +202 -274
  84. package/lib/display/font_loader.js +311 -333
  85. package/lib/display/metadata.js +98 -88
  86. package/lib/display/network.js +343 -347
  87. package/lib/display/network_utils.js +46 -26
  88. package/lib/display/node_stream.js +326 -404
  89. package/lib/display/pattern_helper.js +168 -69
  90. package/lib/display/svg.js +1296 -885
  91. package/lib/display/text_layer.js +229 -103
  92. package/lib/display/transport_stream.js +290 -250
  93. package/lib/display/webgl.js +116 -83
  94. package/lib/display/worker_options.js +6 -5
  95. package/lib/display/xml_parser.js +358 -337
  96. package/lib/examples/node/domstubs.js +95 -39
  97. package/lib/pdf.js +49 -31
  98. package/lib/pdf.worker.js +7 -5
  99. package/lib/shared/compatibility.js +3 -145
  100. package/lib/shared/is_node.js +8 -7
  101. package/lib/shared/message_handler.js +367 -314
  102. package/lib/shared/util.js +421 -415
  103. package/lib/test/unit/annotation_spec.js +1570 -690
  104. package/lib/test/unit/api_spec.js +855 -493
  105. package/lib/test/unit/bidi_spec.js +12 -12
  106. package/lib/test/unit/cff_parser_spec.js +88 -61
  107. package/lib/test/unit/clitests_helper.js +9 -12
  108. package/lib/test/unit/cmap_spec.js +140 -88
  109. package/lib/test/unit/colorspace_spec.js +204 -152
  110. package/lib/test/unit/core_utils_spec.js +211 -0
  111. package/lib/test/unit/crypto_spec.js +194 -182
  112. package/lib/test/unit/custom_spec.js +50 -64
  113. package/lib/test/unit/display_svg_spec.js +53 -38
  114. package/lib/test/unit/display_utils_spec.js +263 -0
  115. package/lib/test/unit/document_spec.js +17 -22
  116. package/lib/test/unit/encodings_spec.js +15 -57
  117. package/lib/test/unit/evaluator_spec.js +90 -83
  118. package/lib/test/unit/fetch_stream_spec.js +111 -0
  119. package/lib/test/unit/function_spec.js +219 -205
  120. package/lib/test/unit/jasmine-boot.js +68 -39
  121. package/lib/test/unit/message_handler_spec.js +187 -160
  122. package/lib/test/unit/metadata_spec.js +87 -34
  123. package/lib/test/unit/murmurhash3_spec.js +13 -13
  124. package/lib/test/unit/network_spec.js +26 -59
  125. package/lib/test/unit/network_utils_spec.js +187 -121
  126. package/lib/test/unit/node_stream_spec.js +98 -90
  127. package/lib/test/unit/parser_spec.js +173 -131
  128. package/lib/test/unit/pdf_find_controller_spec.js +148 -67
  129. package/lib/test/unit/pdf_find_utils_spec.js +35 -34
  130. package/lib/test/unit/pdf_history_spec.js +45 -33
  131. package/lib/test/unit/primitives_spec.js +161 -126
  132. package/lib/test/unit/stream_spec.js +22 -15
  133. package/lib/test/unit/test_utils.js +149 -98
  134. package/lib/test/unit/testreporter.js +36 -18
  135. package/lib/test/unit/type1_parser_spec.js +46 -44
  136. package/lib/test/unit/ui_utils_spec.js +388 -372
  137. package/lib/test/unit/unicode_spec.js +49 -46
  138. package/lib/test/unit/util_spec.js +144 -248
  139. package/lib/web/annotation_layer_builder.js +75 -95
  140. package/lib/web/app.js +1538 -1147
  141. package/lib/web/app_options.js +116 -104
  142. package/lib/web/base_viewer.js +950 -775
  143. package/lib/web/chromecom.js +217 -225
  144. package/lib/web/debugger.js +236 -148
  145. package/lib/web/download_manager.js +50 -50
  146. package/lib/web/firefox_print_service.js +51 -33
  147. package/lib/web/firefoxcom.js +225 -352
  148. package/lib/web/genericcom.js +30 -93
  149. package/lib/web/genericl10n.js +26 -143
  150. package/lib/web/grab_to_pan.js +57 -33
  151. package/lib/web/interfaces.js +105 -232
  152. package/lib/web/overlay_manager.js +73 -227
  153. package/lib/web/password_prompt.js +44 -62
  154. package/lib/web/pdf_attachment_viewer.js +118 -123
  155. package/lib/web/pdf_cursor_tools.js +89 -93
  156. package/lib/web/pdf_document_properties.js +242 -281
  157. package/lib/web/pdf_find_bar.js +157 -163
  158. package/lib/web/pdf_find_controller.js +598 -454
  159. package/lib/web/pdf_find_utils.js +32 -16
  160. package/lib/web/pdf_history.js +481 -355
  161. package/lib/web/pdf_link_service.js +355 -323
  162. package/lib/web/pdf_outline_viewer.js +167 -152
  163. package/lib/web/pdf_page_view.js +511 -457
  164. package/lib/web/pdf_presentation_mode.js +347 -335
  165. package/lib/web/pdf_print_service.js +133 -103
  166. package/lib/web/pdf_rendering_queue.js +98 -100
  167. package/lib/web/pdf_sidebar.js +323 -299
  168. package/lib/web/pdf_sidebar_resizer.js +107 -108
  169. package/lib/web/pdf_single_page_viewer.js +94 -146
  170. package/lib/web/pdf_thumbnail_view.js +319 -269
  171. package/lib/web/pdf_thumbnail_viewer.js +219 -199
  172. package/lib/web/pdf_viewer.component.js +111 -32
  173. package/lib/web/pdf_viewer.js +61 -101
  174. package/lib/web/preferences.js +87 -272
  175. package/lib/web/secondary_toolbar.js +207 -220
  176. package/lib/web/text_layer_builder.js +322 -322
  177. package/lib/web/toolbar.js +227 -180
  178. package/lib/web/ui_utils.js +476 -421
  179. package/lib/web/view_history.js +59 -208
  180. package/lib/web/viewer_compatibility.js +9 -6
  181. package/package.json +2 -9
  182. package/web/pdf_viewer.css +36 -22
  183. package/web/pdf_viewer.js +4407 -4516
  184. package/web/pdf_viewer.js.map +1 -1
  185. package/webpack.js +14 -5
  186. package/external/streams/streams-lib.js +0 -3962
  187. package/external/url/url-lib.js +0 -627
  188. package/lib/display/dom_utils.js +0 -441
  189. package/lib/shared/streams_polyfill.js +0 -39
  190. package/lib/shared/url_polyfill.js +0 -50
  191. package/lib/test/unit/dom_utils_spec.js +0 -89
  192. package/lib/web/dom_events.js +0 -140
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2018 Mozilla Foundation
5
+ * Copyright 2020 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -19,38 +19,44 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
- var _function = require('../../core/function');
24
+ var _function = require("../../core/function.js");
25
25
 
26
- var _ps_parser = require('../../core/ps_parser');
26
+ var _ps_parser = require("../../core/ps_parser.js");
27
27
 
28
- var _stream = require('../../core/stream');
28
+ var _stream = require("../../core/stream.js");
29
29
 
30
- describe('function', function () {
30
+ describe("function", function () {
31
31
  beforeEach(function () {
32
32
  jasmine.addMatchers({
33
- toMatchArray: function toMatchArray(util, customEqualityTesters) {
33
+ toMatchArray(util, customEqualityTesters) {
34
34
  return {
35
- compare: function compare(actual, expected) {
35
+ compare(actual, expected) {
36
36
  var result = {};
37
+
37
38
  if (actual.length !== expected.length) {
38
39
  result.pass = false;
39
- result.message = 'Array length: ' + actual.length + ', expected: ' + expected.length;
40
+ result.message = "Array length: " + actual.length + ", expected: " + expected.length;
40
41
  return result;
41
42
  }
43
+
42
44
  result.pass = true;
45
+
43
46
  for (var i = 0; i < expected.length; i++) {
44
47
  var a = actual[i],
45
48
  b = expected[i];
49
+
46
50
  if (Array.isArray(b)) {
47
51
  if (a.length !== b.length) {
48
52
  result.pass = false;
49
53
  break;
50
54
  }
55
+
51
56
  for (var j = 0; j < a.length; j++) {
52
57
  var suba = a[j],
53
58
  subb = b[j];
59
+
54
60
  if (suba !== subb) {
55
61
  result.pass = false;
56
62
  break;
@@ -63,68 +69,72 @@ describe('function', function () {
63
69
  }
64
70
  }
65
71
  }
72
+
66
73
  return result;
67
74
  }
75
+
68
76
  };
69
77
  }
78
+
70
79
  });
71
80
  });
72
- describe('PostScriptParser', function () {
81
+ describe("PostScriptParser", function () {
73
82
  function parse(program) {
74
83
  var stream = new _stream.StringStream(program);
75
84
  var parser = new _ps_parser.PostScriptParser(new _ps_parser.PostScriptLexer(stream));
76
85
  return parser.parse();
77
86
  }
78
- it('parses empty programs', function () {
79
- var output = parse('{}');
87
+
88
+ it("parses empty programs", function () {
89
+ var output = parse("{}");
80
90
  expect(output.length).toEqual(0);
81
91
  });
82
- it('parses positive numbers', function () {
92
+ it("parses positive numbers", function () {
83
93
  var number = 999;
84
- var program = parse('{ ' + number + ' }');
94
+ var program = parse("{ " + number + " }");
85
95
  var expectedProgram = [number];
86
96
  expect(program).toMatchArray(expectedProgram);
87
97
  });
88
- it('parses negative numbers', function () {
98
+ it("parses negative numbers", function () {
89
99
  var number = -999;
90
- var program = parse('{ ' + number + ' }');
100
+ var program = parse("{ " + number + " }");
91
101
  var expectedProgram = [number];
92
102
  expect(program).toMatchArray(expectedProgram);
93
103
  });
94
- it('parses negative floats', function () {
104
+ it("parses negative floats", function () {
95
105
  var number = 3.3;
96
- var program = parse('{ ' + number + ' }');
106
+ var program = parse("{ " + number + " }");
97
107
  var expectedProgram = [number];
98
108
  expect(program).toMatchArray(expectedProgram);
99
109
  });
100
- it('parses operators', function () {
101
- var program = parse('{ sub }');
102
- var expectedProgram = ['sub'];
110
+ it("parses operators", function () {
111
+ var program = parse("{ sub }");
112
+ var expectedProgram = ["sub"];
103
113
  expect(program).toMatchArray(expectedProgram);
104
114
  });
105
- it('parses if statements', function () {
106
- var program = parse('{ { 99 } if }');
107
- var expectedProgram = [3, 'jz', 99];
115
+ it("parses if statements", function () {
116
+ var program = parse("{ { 99 } if }");
117
+ var expectedProgram = [3, "jz", 99];
108
118
  expect(program).toMatchArray(expectedProgram);
109
119
  });
110
- it('parses ifelse statements', function () {
111
- var program = parse('{ { 99 } { 44 } ifelse }');
112
- var expectedProgram = [5, 'jz', 99, 6, 'j', 44];
120
+ it("parses ifelse statements", function () {
121
+ var program = parse("{ { 99 } { 44 } ifelse }");
122
+ var expectedProgram = [5, "jz", 99, 6, "j", 44];
113
123
  expect(program).toMatchArray(expectedProgram);
114
124
  });
115
- it('handles missing brackets', function () {
125
+ it("handles missing brackets", function () {
116
126
  expect(function () {
117
- parse('{');
118
- }).toThrow(new Error('Unexpected symbol: found undefined expected 1.'));
127
+ parse("{");
128
+ }).toThrow(new Error("Unexpected symbol: found undefined expected 1."));
119
129
  });
120
- it('handles junk after the end', function () {
130
+ it("handles junk after the end", function () {
121
131
  var number = 3.3;
122
- var program = parse('{ ' + number + ' }#');
132
+ var program = parse("{ " + number + " }#");
123
133
  var expectedProgram = [number];
124
134
  expect(program).toMatchArray(expectedProgram);
125
135
  });
126
136
  });
127
- describe('PostScriptEvaluator', function () {
137
+ describe("PostScriptEvaluator", function () {
128
138
  function evaluate(program) {
129
139
  var stream = new _stream.StringStream(program);
130
140
  var parser = new _ps_parser.PostScriptParser(new _ps_parser.PostScriptLexer(stream));
@@ -133,326 +143,329 @@ describe('function', function () {
133
143
  var output = evaluator.execute();
134
144
  return output;
135
145
  }
136
- it('pushes stack', function () {
137
- var stack = evaluate('{ 99 }');
146
+
147
+ it("pushes stack", function () {
148
+ var stack = evaluate("{ 99 }");
138
149
  var expectedStack = [99];
139
150
  expect(stack).toMatchArray(expectedStack);
140
151
  });
141
- it('handles if with true', function () {
142
- var stack = evaluate('{ 1 {99} if }');
152
+ it("handles if with true", function () {
153
+ var stack = evaluate("{ 1 {99} if }");
143
154
  var expectedStack = [99];
144
155
  expect(stack).toMatchArray(expectedStack);
145
156
  });
146
- it('handles if with false', function () {
147
- var stack = evaluate('{ 0 {99} if }');
157
+ it("handles if with false", function () {
158
+ var stack = evaluate("{ 0 {99} if }");
148
159
  var expectedStack = [];
149
160
  expect(stack).toMatchArray(expectedStack);
150
161
  });
151
- it('handles ifelse with true', function () {
152
- var stack = evaluate('{ 1 {99} {77} ifelse }');
162
+ it("handles ifelse with true", function () {
163
+ var stack = evaluate("{ 1 {99} {77} ifelse }");
153
164
  var expectedStack = [99];
154
165
  expect(stack).toMatchArray(expectedStack);
155
166
  });
156
- it('handles ifelse with false', function () {
157
- var stack = evaluate('{ 0 {99} {77} ifelse }');
167
+ it("handles ifelse with false", function () {
168
+ var stack = evaluate("{ 0 {99} {77} ifelse }");
158
169
  var expectedStack = [77];
159
170
  expect(stack).toMatchArray(expectedStack);
160
171
  });
161
- it('handles nested if', function () {
162
- var stack = evaluate('{ 1 {1 {77} if} if }');
172
+ it("handles nested if", function () {
173
+ var stack = evaluate("{ 1 {1 {77} if} if }");
163
174
  var expectedStack = [77];
164
175
  expect(stack).toMatchArray(expectedStack);
165
176
  });
166
- it('abs', function () {
167
- var stack = evaluate('{ -2 abs }');
177
+ it("abs", function () {
178
+ var stack = evaluate("{ -2 abs }");
168
179
  var expectedStack = [2];
169
180
  expect(stack).toMatchArray(expectedStack);
170
181
  });
171
- it('adds', function () {
172
- var stack = evaluate('{ 1 2 add }');
182
+ it("adds", function () {
183
+ var stack = evaluate("{ 1 2 add }");
173
184
  var expectedStack = [3];
174
185
  expect(stack).toMatchArray(expectedStack);
175
186
  });
176
- it('boolean and', function () {
177
- var stack = evaluate('{ true false and }');
187
+ it("boolean and", function () {
188
+ var stack = evaluate("{ true false and }");
178
189
  var expectedStack = [false];
179
190
  expect(stack).toMatchArray(expectedStack);
180
191
  });
181
- it('bitwise and', function () {
182
- var stack = evaluate('{ 254 1 and }');
192
+ it("bitwise and", function () {
193
+ var stack = evaluate("{ 254 1 and }");
183
194
  var expectedStack = [254 & 1];
184
195
  expect(stack).toMatchArray(expectedStack);
185
196
  });
186
- it('calculates the inverse tangent of a number', function () {
187
- var stack = evaluate('{ 90 atan }');
197
+ it("calculates the inverse tangent of a number", function () {
198
+ var stack = evaluate("{ 90 atan }");
188
199
  var expectedStack = [Math.atan(90)];
189
200
  expect(stack).toMatchArray(expectedStack);
190
201
  });
191
- it('handles bitshifting ', function () {
192
- var stack = evaluate('{ 50 2 bitshift }');
202
+ it("handles bitshifting ", function () {
203
+ var stack = evaluate("{ 50 2 bitshift }");
193
204
  var expectedStack = [200];
194
205
  expect(stack).toMatchArray(expectedStack);
195
206
  });
196
- it('calculates the ceiling value', function () {
197
- var stack = evaluate('{ 9.9 ceiling }');
207
+ it("calculates the ceiling value", function () {
208
+ var stack = evaluate("{ 9.9 ceiling }");
198
209
  var expectedStack = [10];
199
210
  expect(stack).toMatchArray(expectedStack);
200
211
  });
201
- it('copies', function () {
202
- var stack = evaluate('{ 99 98 2 copy }');
212
+ it("copies", function () {
213
+ var stack = evaluate("{ 99 98 2 copy }");
203
214
  var expectedStack = [99, 98, 99, 98];
204
215
  expect(stack).toMatchArray(expectedStack);
205
216
  });
206
- it('calculates the cosine of a number', function () {
207
- var stack = evaluate('{ 90 cos }');
217
+ it("calculates the cosine of a number", function () {
218
+ var stack = evaluate("{ 90 cos }");
208
219
  var expectedStack = [Math.cos(90)];
209
220
  expect(stack).toMatchArray(expectedStack);
210
221
  });
211
- it('converts to int', function () {
212
- var stack = evaluate('{ 9.9 cvi }');
222
+ it("converts to int", function () {
223
+ var stack = evaluate("{ 9.9 cvi }");
213
224
  var expectedStack = [9];
214
225
  expect(stack).toMatchArray(expectedStack);
215
226
  });
216
- it('converts negatives to int', function () {
217
- var stack = evaluate('{ -9.9 cvi }');
227
+ it("converts negatives to int", function () {
228
+ var stack = evaluate("{ -9.9 cvi }");
218
229
  var expectedStack = [-9];
219
230
  expect(stack).toMatchArray(expectedStack);
220
231
  });
221
- it('converts to real', function () {
222
- var stack = evaluate('{ 55.34 cvr }');
232
+ it("converts to real", function () {
233
+ var stack = evaluate("{ 55.34 cvr }");
223
234
  var expectedStack = [55.34];
224
235
  expect(stack).toMatchArray(expectedStack);
225
236
  });
226
- it('divides', function () {
227
- var stack = evaluate('{ 6 5 div }');
237
+ it("divides", function () {
238
+ var stack = evaluate("{ 6 5 div }");
228
239
  var expectedStack = [1.2];
229
240
  expect(stack).toMatchArray(expectedStack);
230
241
  });
231
- it('maps division by zero to infinity', function () {
232
- var stack = evaluate('{ 6 0 div }');
242
+ it("maps division by zero to infinity", function () {
243
+ var stack = evaluate("{ 6 0 div }");
233
244
  var expectedStack = [Infinity];
234
245
  expect(stack).toMatchArray(expectedStack);
235
246
  });
236
- it('duplicates', function () {
237
- var stack = evaluate('{ 99 dup }');
247
+ it("duplicates", function () {
248
+ var stack = evaluate("{ 99 dup }");
238
249
  var expectedStack = [99, 99];
239
250
  expect(stack).toMatchArray(expectedStack);
240
251
  });
241
- it('accepts an equality', function () {
242
- var stack = evaluate('{ 9 9 eq }');
252
+ it("accepts an equality", function () {
253
+ var stack = evaluate("{ 9 9 eq }");
243
254
  var expectedStack = [true];
244
255
  expect(stack).toMatchArray(expectedStack);
245
256
  });
246
- it('rejects an inequality', function () {
247
- var stack = evaluate('{ 9 8 eq }');
257
+ it("rejects an inequality", function () {
258
+ var stack = evaluate("{ 9 8 eq }");
248
259
  var expectedStack = [false];
249
260
  expect(stack).toMatchArray(expectedStack);
250
261
  });
251
- it('exchanges', function () {
252
- var stack = evaluate('{ 44 99 exch }');
262
+ it("exchanges", function () {
263
+ var stack = evaluate("{ 44 99 exch }");
253
264
  var expectedStack = [99, 44];
254
265
  expect(stack).toMatchArray(expectedStack);
255
266
  });
256
- it('handles exponentiation', function () {
257
- var stack = evaluate('{ 10 2 exp }');
267
+ it("handles exponentiation", function () {
268
+ var stack = evaluate("{ 10 2 exp }");
258
269
  var expectedStack = [100];
259
270
  expect(stack).toMatchArray(expectedStack);
260
271
  });
261
- it('pushes false onto the stack', function () {
262
- var stack = evaluate('{ false }');
272
+ it("pushes false onto the stack", function () {
273
+ var stack = evaluate("{ false }");
263
274
  var expectedStack = [false];
264
275
  expect(stack).toMatchArray(expectedStack);
265
276
  });
266
- it('calculates the floor value', function () {
267
- var stack = evaluate('{ 9.9 floor }');
277
+ it("calculates the floor value", function () {
278
+ var stack = evaluate("{ 9.9 floor }");
268
279
  var expectedStack = [9];
269
280
  expect(stack).toMatchArray(expectedStack);
270
281
  });
271
- it('handles greater than or equal to', function () {
272
- var stack = evaluate('{ 10 9 ge }');
282
+ it("handles greater than or equal to", function () {
283
+ var stack = evaluate("{ 10 9 ge }");
273
284
  var expectedStack = [true];
274
285
  expect(stack).toMatchArray(expectedStack);
275
286
  });
276
- it('rejects less than for greater than or equal to', function () {
277
- var stack = evaluate('{ 8 9 ge }');
287
+ it("rejects less than for greater than or equal to", function () {
288
+ var stack = evaluate("{ 8 9 ge }");
278
289
  var expectedStack = [false];
279
290
  expect(stack).toMatchArray(expectedStack);
280
291
  });
281
- it('handles greater than', function () {
282
- var stack = evaluate('{ 10 9 gt }');
292
+ it("handles greater than", function () {
293
+ var stack = evaluate("{ 10 9 gt }");
283
294
  var expectedStack = [true];
284
295
  expect(stack).toMatchArray(expectedStack);
285
296
  });
286
- it('rejects less than or equal for greater than', function () {
287
- var stack = evaluate('{ 9 9 gt }');
297
+ it("rejects less than or equal for greater than", function () {
298
+ var stack = evaluate("{ 9 9 gt }");
288
299
  var expectedStack = [false];
289
300
  expect(stack).toMatchArray(expectedStack);
290
301
  });
291
- it('divides to integer', function () {
292
- var stack = evaluate('{ 2 3 idiv }');
302
+ it("divides to integer", function () {
303
+ var stack = evaluate("{ 2 3 idiv }");
293
304
  var expectedStack = [0];
294
305
  expect(stack).toMatchArray(expectedStack);
295
306
  });
296
- it('divides to negative integer', function () {
297
- var stack = evaluate('{ -2 3 idiv }');
307
+ it("divides to negative integer", function () {
308
+ var stack = evaluate("{ -2 3 idiv }");
298
309
  var expectedStack = [0];
299
310
  expect(stack).toMatchArray(expectedStack);
300
311
  });
301
- it('duplicates index', function () {
302
- var stack = evaluate('{ 4 3 2 1 2 index }');
312
+ it("duplicates index", function () {
313
+ var stack = evaluate("{ 4 3 2 1 2 index }");
303
314
  var expectedStack = [4, 3, 2, 1, 3];
304
315
  expect(stack).toMatchArray(expectedStack);
305
316
  });
306
- it('handles less than or equal to', function () {
307
- var stack = evaluate('{ 9 10 le }');
317
+ it("handles less than or equal to", function () {
318
+ var stack = evaluate("{ 9 10 le }");
308
319
  var expectedStack = [true];
309
320
  expect(stack).toMatchArray(expectedStack);
310
321
  });
311
- it('rejects greater than for less than or equal to', function () {
312
- var stack = evaluate('{ 10 9 le }');
322
+ it("rejects greater than for less than or equal to", function () {
323
+ var stack = evaluate("{ 10 9 le }");
313
324
  var expectedStack = [false];
314
325
  expect(stack).toMatchArray(expectedStack);
315
326
  });
316
- it('calculates the natural logarithm', function () {
317
- var stack = evaluate('{ 10 ln }');
327
+ it("calculates the natural logarithm", function () {
328
+ var stack = evaluate("{ 10 ln }");
318
329
  var expectedStack = [Math.log(10)];
319
330
  expect(stack).toMatchArray(expectedStack);
320
331
  });
321
- it('calculates the base 10 logarithm', function () {
322
- var stack = evaluate('{ 100 log }');
332
+ it("calculates the base 10 logarithm", function () {
333
+ var stack = evaluate("{ 100 log }");
323
334
  var expectedStack = [2];
324
335
  expect(stack).toMatchArray(expectedStack);
325
336
  });
326
- it('handles less than', function () {
327
- var stack = evaluate('{ 9 10 lt }');
337
+ it("handles less than", function () {
338
+ var stack = evaluate("{ 9 10 lt }");
328
339
  var expectedStack = [true];
329
340
  expect(stack).toMatchArray(expectedStack);
330
341
  });
331
- it('rejects greater than or equal to for less than', function () {
332
- var stack = evaluate('{ 10 9 lt }');
342
+ it("rejects greater than or equal to for less than", function () {
343
+ var stack = evaluate("{ 10 9 lt }");
333
344
  var expectedStack = [false];
334
345
  expect(stack).toMatchArray(expectedStack);
335
346
  });
336
- it('performs the modulo operation', function () {
337
- var stack = evaluate('{ 4 3 mod }');
347
+ it("performs the modulo operation", function () {
348
+ var stack = evaluate("{ 4 3 mod }");
338
349
  var expectedStack = [1];
339
350
  expect(stack).toMatchArray(expectedStack);
340
351
  });
341
- it('multiplies two numbers (positive result)', function () {
342
- var stack = evaluate('{ 9 8 mul }');
352
+ it("multiplies two numbers (positive result)", function () {
353
+ var stack = evaluate("{ 9 8 mul }");
343
354
  var expectedStack = [72];
344
355
  expect(stack).toMatchArray(expectedStack);
345
356
  });
346
- it('multiplies two numbers (negative result)', function () {
347
- var stack = evaluate('{ 9 -8 mul }');
357
+ it("multiplies two numbers (negative result)", function () {
358
+ var stack = evaluate("{ 9 -8 mul }");
348
359
  var expectedStack = [-72];
349
360
  expect(stack).toMatchArray(expectedStack);
350
361
  });
351
- it('accepts an inequality', function () {
352
- var stack = evaluate('{ 9 8 ne }');
362
+ it("accepts an inequality", function () {
363
+ var stack = evaluate("{ 9 8 ne }");
353
364
  var expectedStack = [true];
354
365
  expect(stack).toMatchArray(expectedStack);
355
366
  });
356
- it('rejects an equality', function () {
357
- var stack = evaluate('{ 9 9 ne }');
367
+ it("rejects an equality", function () {
368
+ var stack = evaluate("{ 9 9 ne }");
358
369
  var expectedStack = [false];
359
370
  expect(stack).toMatchArray(expectedStack);
360
371
  });
361
- it('negates', function () {
362
- var stack = evaluate('{ 4.5 neg }');
372
+ it("negates", function () {
373
+ var stack = evaluate("{ 4.5 neg }");
363
374
  var expectedStack = [-4.5];
364
375
  expect(stack).toMatchArray(expectedStack);
365
376
  });
366
- it('boolean not', function () {
367
- var stack = evaluate('{ true not }');
377
+ it("boolean not", function () {
378
+ var stack = evaluate("{ true not }");
368
379
  var expectedStack = [false];
369
380
  expect(stack).toMatchArray(expectedStack);
370
381
  });
371
- it('bitwise not', function () {
372
- var stack = evaluate('{ 12 not }');
382
+ it("bitwise not", function () {
383
+ var stack = evaluate("{ 12 not }");
373
384
  var expectedStack = [-13];
374
385
  expect(stack).toMatchArray(expectedStack);
375
386
  });
376
- it('boolean or', function () {
377
- var stack = evaluate('{ true false or }');
387
+ it("boolean or", function () {
388
+ var stack = evaluate("{ true false or }");
378
389
  var expectedStack = [true];
379
390
  expect(stack).toMatchArray(expectedStack);
380
391
  });
381
- it('bitwise or', function () {
382
- var stack = evaluate('{ 254 1 or }');
392
+ it("bitwise or", function () {
393
+ var stack = evaluate("{ 254 1 or }");
383
394
  var expectedStack = [254 | 1];
384
395
  expect(stack).toMatchArray(expectedStack);
385
396
  });
386
- it('pops stack', function () {
387
- var stack = evaluate('{ 1 2 pop }');
397
+ it("pops stack", function () {
398
+ var stack = evaluate("{ 1 2 pop }");
388
399
  var expectedStack = [1];
389
400
  expect(stack).toMatchArray(expectedStack);
390
401
  });
391
- it('rolls stack right', function () {
392
- var stack = evaluate('{ 1 3 2 2 4 1 roll }');
402
+ it("rolls stack right", function () {
403
+ var stack = evaluate("{ 1 3 2 2 4 1 roll }");
393
404
  var expectedStack = [2, 1, 3, 2];
394
405
  expect(stack).toMatchArray(expectedStack);
395
406
  });
396
- it('rolls stack left', function () {
397
- var stack = evaluate('{ 1 3 2 2 4 -1 roll }');
407
+ it("rolls stack left", function () {
408
+ var stack = evaluate("{ 1 3 2 2 4 -1 roll }");
398
409
  var expectedStack = [3, 2, 2, 1];
399
410
  expect(stack).toMatchArray(expectedStack);
400
411
  });
401
- it('rounds a number', function () {
402
- var stack = evaluate('{ 9.52 round }');
412
+ it("rounds a number", function () {
413
+ var stack = evaluate("{ 9.52 round }");
403
414
  var expectedStack = [10];
404
415
  expect(stack).toMatchArray(expectedStack);
405
416
  });
406
- it('calculates the sine of a number', function () {
407
- var stack = evaluate('{ 90 sin }');
417
+ it("calculates the sine of a number", function () {
418
+ var stack = evaluate("{ 90 sin }");
408
419
  var expectedStack = [Math.sin(90)];
409
420
  expect(stack).toMatchArray(expectedStack);
410
421
  });
411
- it('calculates a square root (integer)', function () {
412
- var stack = evaluate('{ 100 sqrt }');
422
+ it("calculates a square root (integer)", function () {
423
+ var stack = evaluate("{ 100 sqrt }");
413
424
  var expectedStack = [10];
414
425
  expect(stack).toMatchArray(expectedStack);
415
426
  });
416
- it('calculates a square root (float)', function () {
417
- var stack = evaluate('{ 99 sqrt }');
427
+ it("calculates a square root (float)", function () {
428
+ var stack = evaluate("{ 99 sqrt }");
418
429
  var expectedStack = [Math.sqrt(99)];
419
430
  expect(stack).toMatchArray(expectedStack);
420
431
  });
421
- it('subtracts (positive result)', function () {
422
- var stack = evaluate('{ 6 4 sub }');
432
+ it("subtracts (positive result)", function () {
433
+ var stack = evaluate("{ 6 4 sub }");
423
434
  var expectedStack = [2];
424
435
  expect(stack).toMatchArray(expectedStack);
425
436
  });
426
- it('subtracts (negative result)', function () {
427
- var stack = evaluate('{ 4 6 sub }');
437
+ it("subtracts (negative result)", function () {
438
+ var stack = evaluate("{ 4 6 sub }");
428
439
  var expectedStack = [-2];
429
440
  expect(stack).toMatchArray(expectedStack);
430
441
  });
431
- it('pushes true onto the stack', function () {
432
- var stack = evaluate('{ true }');
442
+ it("pushes true onto the stack", function () {
443
+ var stack = evaluate("{ true }");
433
444
  var expectedStack = [true];
434
445
  expect(stack).toMatchArray(expectedStack);
435
446
  });
436
- it('truncates a number', function () {
437
- var stack = evaluate('{ 35.004 truncate }');
447
+ it("truncates a number", function () {
448
+ var stack = evaluate("{ 35.004 truncate }");
438
449
  var expectedStack = [35];
439
450
  expect(stack).toMatchArray(expectedStack);
440
451
  });
441
- it('calculates an exclusive or value', function () {
442
- var stack = evaluate('{ 3 9 xor }');
452
+ it("calculates an exclusive or value", function () {
453
+ var stack = evaluate("{ 3 9 xor }");
443
454
  var expectedStack = [10];
444
455
  expect(stack).toMatchArray(expectedStack);
445
456
  });
446
457
  });
447
- describe('PostScriptCompiler', function () {
458
+ describe("PostScriptCompiler", function () {
448
459
  function check(code, domain, range, samples) {
449
460
  var compiler = new _function.PostScriptCompiler();
450
461
  var compiledCode = compiler.compile(code, domain, range);
462
+
451
463
  if (samples === null) {
452
464
  expect(compiledCode).toBeNull();
453
465
  } else {
454
466
  expect(compiledCode).not.toBeNull();
455
- var fn = new Function('src', 'srcOffset', 'dest', 'destOffset', compiledCode);
467
+ var fn = new Function("src", "srcOffset", "dest", "destOffset", compiledCode);
468
+
456
469
  for (var i = 0; i < samples.length; i++) {
457
470
  var out = new Float32Array(samples[i].output.length);
458
471
  fn(samples[i].input, 0, out, 0);
@@ -460,132 +473,133 @@ describe('function', function () {
460
473
  }
461
474
  }
462
475
  }
463
- it('check compiled add', function () {
464
- check([0.25, 0.5, 'add'], [], [0, 1], [{
476
+
477
+ it("check compiled add", function () {
478
+ check([0.25, 0.5, "add"], [], [0, 1], [{
465
479
  input: [],
466
480
  output: [0.75]
467
481
  }]);
468
- check([0, 'add'], [0, 1], [0, 1], [{
482
+ check([0, "add"], [0, 1], [0, 1], [{
469
483
  input: [0.25],
470
484
  output: [0.25]
471
485
  }]);
472
- check([0.5, 'add'], [0, 1], [0, 1], [{
486
+ check([0.5, "add"], [0, 1], [0, 1], [{
473
487
  input: [0.25],
474
488
  output: [0.75]
475
489
  }]);
476
- check([0, 'exch', 'add'], [0, 1], [0, 1], [{
490
+ check([0, "exch", "add"], [0, 1], [0, 1], [{
477
491
  input: [0.25],
478
492
  output: [0.25]
479
493
  }]);
480
- check([0.5, 'exch', 'add'], [0, 1], [0, 1], [{
494
+ check([0.5, "exch", "add"], [0, 1], [0, 1], [{
481
495
  input: [0.25],
482
496
  output: [0.75]
483
497
  }]);
484
- check(['add'], [0, 1, 0, 1], [0, 1], [{
498
+ check(["add"], [0, 1, 0, 1], [0, 1], [{
485
499
  input: [0.25, 0.5],
486
500
  output: [0.75]
487
501
  }]);
488
- check(['add'], [0, 1], [0, 1], null);
502
+ check(["add"], [0, 1], [0, 1], null);
489
503
  });
490
- it('check compiled sub', function () {
491
- check([0.5, 0.25, 'sub'], [], [0, 1], [{
504
+ it("check compiled sub", function () {
505
+ check([0.5, 0.25, "sub"], [], [0, 1], [{
492
506
  input: [],
493
507
  output: [0.25]
494
508
  }]);
495
- check([0, 'sub'], [0, 1], [0, 1], [{
509
+ check([0, "sub"], [0, 1], [0, 1], [{
496
510
  input: [0.25],
497
511
  output: [0.25]
498
512
  }]);
499
- check([0.5, 'sub'], [0, 1], [0, 1], [{
513
+ check([0.5, "sub"], [0, 1], [0, 1], [{
500
514
  input: [0.75],
501
515
  output: [0.25]
502
516
  }]);
503
- check([0, 'exch', 'sub'], [0, 1], [-1, 1], [{
517
+ check([0, "exch", "sub"], [0, 1], [-1, 1], [{
504
518
  input: [0.25],
505
519
  output: [-0.25]
506
520
  }]);
507
- check([0.75, 'exch', 'sub'], [0, 1], [-1, 1], [{
521
+ check([0.75, "exch", "sub"], [0, 1], [-1, 1], [{
508
522
  input: [0.25],
509
523
  output: [0.5]
510
524
  }]);
511
- check(['sub'], [0, 1, 0, 1], [-1, 1], [{
525
+ check(["sub"], [0, 1, 0, 1], [-1, 1], [{
512
526
  input: [0.25, 0.5],
513
527
  output: [-0.25]
514
528
  }]);
515
- check(['sub'], [0, 1], [0, 1], null);
516
- check([1, 'dup', 3, 2, 'roll', 'sub', 'sub'], [0, 1], [0, 1], [{
529
+ check(["sub"], [0, 1], [0, 1], null);
530
+ check([1, "dup", 3, 2, "roll", "sub", "sub"], [0, 1], [0, 1], [{
517
531
  input: [0.75],
518
532
  output: [0.75]
519
533
  }]);
520
534
  });
521
- it('check compiled mul', function () {
522
- check([0.25, 0.5, 'mul'], [], [0, 1], [{
535
+ it("check compiled mul", function () {
536
+ check([0.25, 0.5, "mul"], [], [0, 1], [{
523
537
  input: [],
524
538
  output: [0.125]
525
539
  }]);
526
- check([0, 'mul'], [0, 1], [0, 1], [{
540
+ check([0, "mul"], [0, 1], [0, 1], [{
527
541
  input: [0.25],
528
542
  output: [0]
529
543
  }]);
530
- check([0.5, 'mul'], [0, 1], [0, 1], [{
544
+ check([0.5, "mul"], [0, 1], [0, 1], [{
531
545
  input: [0.25],
532
546
  output: [0.125]
533
547
  }]);
534
- check([1, 'mul'], [0, 1], [0, 1], [{
548
+ check([1, "mul"], [0, 1], [0, 1], [{
535
549
  input: [0.25],
536
550
  output: [0.25]
537
551
  }]);
538
- check([0, 'exch', 'mul'], [0, 1], [0, 1], [{
552
+ check([0, "exch", "mul"], [0, 1], [0, 1], [{
539
553
  input: [0.25],
540
554
  output: [0]
541
555
  }]);
542
- check([0.5, 'exch', 'mul'], [0, 1], [0, 1], [{
556
+ check([0.5, "exch", "mul"], [0, 1], [0, 1], [{
543
557
  input: [0.25],
544
558
  output: [0.125]
545
559
  }]);
546
- check([1, 'exch', 'mul'], [0, 1], [0, 1], [{
560
+ check([1, "exch", "mul"], [0, 1], [0, 1], [{
547
561
  input: [0.25],
548
562
  output: [0.25]
549
563
  }]);
550
- check(['mul'], [0, 1, 0, 1], [0, 1], [{
564
+ check(["mul"], [0, 1, 0, 1], [0, 1], [{
551
565
  input: [0.25, 0.5],
552
566
  output: [0.125]
553
567
  }]);
554
- check(['mul'], [0, 1], [0, 1], null);
568
+ check(["mul"], [0, 1], [0, 1], null);
555
569
  });
556
- it('check compiled max', function () {
557
- check(['dup', 0.75, 'gt', 7, 'jz', 'pop', 0.75], [0, 1], [0, 1], [{
570
+ it("check compiled max", function () {
571
+ check(["dup", 0.75, "gt", 7, "jz", "pop", 0.75], [0, 1], [0, 1], [{
558
572
  input: [0.5],
559
573
  output: [0.5]
560
574
  }]);
561
- check(['dup', 0.75, 'gt', 7, 'jz', 'pop', 0.75], [0, 1], [0, 1], [{
575
+ check(["dup", 0.75, "gt", 7, "jz", "pop", 0.75], [0, 1], [0, 1], [{
562
576
  input: [1],
563
577
  output: [0.75]
564
578
  }]);
565
- check(['dup', 0.75, 'gt', 5, 'jz', 'pop', 0.75], [0, 1], [0, 1], null);
579
+ check(["dup", 0.75, "gt", 5, "jz", "pop", 0.75], [0, 1], [0, 1], null);
566
580
  });
567
- it('check pop/roll/index', function () {
568
- check([1, 'pop'], [0, 1], [0, 1], [{
581
+ it("check pop/roll/index", function () {
582
+ check([1, "pop"], [0, 1], [0, 1], [{
569
583
  input: [0.5],
570
584
  output: [0.5]
571
585
  }]);
572
- check([1, 3, -1, 'roll'], [0, 1, 0, 1], [0, 1, 0, 1, 0, 1], [{
586
+ check([1, 3, -1, "roll"], [0, 1, 0, 1], [0, 1, 0, 1, 0, 1], [{
573
587
  input: [0.25, 0.5],
574
588
  output: [0.5, 1, 0.25]
575
589
  }]);
576
- check([1, 3, 1, 'roll'], [0, 1, 0, 1], [0, 1, 0, 1, 0, 1], [{
590
+ check([1, 3, 1, "roll"], [0, 1, 0, 1], [0, 1, 0, 1, 0, 1], [{
577
591
  input: [0.25, 0.5],
578
592
  output: [1, 0.25, 0.5]
579
593
  }]);
580
- check([1, 3, 1.5, 'roll'], [0, 1, 0, 1], [0, 1, 0, 1, 0, 1], null);
581
- check([1, 1, 'index'], [0, 1], [0, 1, 0, 1, 0, 1], [{
594
+ check([1, 3, 1.5, "roll"], [0, 1, 0, 1], [0, 1, 0, 1, 0, 1], null);
595
+ check([1, 1, "index"], [0, 1], [0, 1, 0, 1, 0, 1], [{
582
596
  input: [0.5],
583
597
  output: [0.5, 1, 0.5]
584
598
  }]);
585
- check([1, 3, 'index', 'pop'], [0, 1], [0, 1], null);
586
- check([1, 0.5, 'index', 'pop'], [0, 1], [0, 1], null);
599
+ check([1, 3, "index", "pop"], [0, 1], [0, 1], null);
600
+ check([1, 0.5, "index", "pop"], [0, 1], [0, 1], null);
587
601
  });
588
- it('check input boundaries', function () {
602
+ it("check input boundaries", function () {
589
603
  check([], [0, 0.5], [0, 1], [{
590
604
  input: [1],
591
605
  output: [0.5]
@@ -594,7 +608,7 @@ describe('function', function () {
594
608
  input: [0],
595
609
  output: [0.5]
596
610
  }]);
597
- check(['dup'], [0.5, 0.75], [0, 1, 0, 1], [{
611
+ check(["dup"], [0.5, 0.75], [0, 1, 0, 1], [{
598
612
  input: [0],
599
613
  output: [0.5, 0.5]
600
614
  }]);
@@ -603,7 +617,7 @@ describe('function', function () {
603
617
  output: [1000]
604
618
  }]);
605
619
  });
606
- it('check output boundaries', function () {
620
+ it("check output boundaries", function () {
607
621
  check([], [0, 1], [0, 0.5], [{
608
622
  input: [1],
609
623
  output: [0.5]
@@ -612,7 +626,7 @@ describe('function', function () {
612
626
  input: [0],
613
627
  output: [0.5]
614
628
  }]);
615
- check(['dup'], [0, 1], [0.5, 1, 0.75, 1], [{
629
+ check(["dup"], [0, 1], [0.5, 1, 0.75, 1], [{
616
630
  input: [0],
617
631
  output: [0.5, 0.75]
618
632
  }]);
@@ -621,11 +635,11 @@ describe('function', function () {
621
635
  output: [1000]
622
636
  }]);
623
637
  });
624
- it('compile optimized', function () {
638
+ it("compile optimized", function () {
625
639
  var compiler = new _function.PostScriptCompiler();
626
- var code = [0, 'add', 1, 1, 3, -1, 'roll', 'sub', 'sub', 1, 'mul'];
640
+ var code = [0, "add", 1, 1, 3, -1, "roll", "sub", "sub", 1, "mul"];
627
641
  var compiledCode = compiler.compile(code, [0, 1], [0, 1]);
628
- expect(compiledCode).toEqual('dest[destOffset + 0] = Math.max(0, Math.min(1, src[srcOffset + 0]));');
642
+ expect(compiledCode).toEqual("dest[destOffset + 0] = Math.max(0, Math.min(1, src[srcOffset + 0]));");
629
643
  });
630
644
  });
631
645
  });