[Pkg-javascript-commits] [node-text-encoding] 01/06: New upstream version 0.6.2

Julien Puydt julien.puydt at laposte.net
Tue Nov 22 16:15:05 UTC 2016


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to annotated tag debian/0.6.2-1
in repository node-text-encoding.

commit 1e41b6451face4fb3580120172349f335b37d19e
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Sat Nov 19 21:53:22 2016 +0100

    New upstream version 0.6.2
---
 bower.json              |  2 +-
 lib/encoding-indexes.js |  2 +-
 lib/encoding.js         | 14 +++++++-------
 package.json            |  2 +-
 test/test-misc.js       | 12 ++++++++++++
 5 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/bower.json b/bower.json
index 9c83327..ef72a42 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
 {
   "name": "text-encoding",
-  "version": "0.6.0",
+  "version": "0.6.1",
   "homepage": "https://github.com/inexorabletash/text-encoding",
   "authors": [
     "Joshua Bell <inexorabletash at gmail.com>",
diff --git a/lib/encoding-indexes.js b/lib/encoding-indexes.js
index 4091600..5fd98f5 100644
--- a/lib/encoding-indexes.js
+++ b/lib/encoding-indexes.js
@@ -30,7 +30,7 @@
   "windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,2 [...]
   "windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,96 [...]
   "windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,2 [...]
-  "windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,null,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495, [...]
+  "windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495, [...]
   "windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607 [...]
   "windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324 [...]
   "windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,8 [...]
diff --git a/lib/encoding.js b/lib/encoding.js
index 2011e9d..b5c8904 100644
--- a/lib/encoding.js
+++ b/lib/encoding.js
@@ -6,9 +6,9 @@
  * @fileoverview Global |this| required for resolving indexes in node.
  * @suppress {globalThis}
  */
-if (typeof module !== "undefined" && module.exports) {
-  this["encoding-indexes"] =
-    require("./encoding-indexes.js")["encoding-indexes"];
+if (typeof module !== "undefined" && module.exports &&
+    !this["encoding-indexes"]) {
+    require("./encoding-indexes.js");
 }
 
 (function(global) {
@@ -844,7 +844,7 @@ if (typeof module !== "undefined" && module.exports) {
   function index(name) {
     if (!('encoding-indexes' in global)) {
       throw Error("Indexes missing." +
-                  " Did you forget to include encoding-indexes.js?");
+                  " Did you forget to include encoding-indexes.js first?");
     }
     return global['encoding-indexes'][name];
   }
@@ -1015,7 +1015,7 @@ if (typeof module !== "undefined" && module.exports) {
       throw RangeError('Unknown encoding: ' + label);
     if (!decoders[encoding.name]) {
       throw Error('Decoder not present.' +
-                  ' Did you forget to include encoding-indexes.js?');
+                  ' Did you forget to include encoding-indexes.js first?');
     }
 
     // 3. Let dec be a new TextDecoder object.
@@ -1233,7 +1233,7 @@ if (typeof module !== "undefined" && module.exports) {
         throw RangeError('Unknown encoding: ' + label);
       if (!encoders[encoding.name]) {
         throw Error('Encoder not present.' +
-                    ' Did you forget to include encoding-indexes.js?');
+                    ' Did you forget to include encoding-indexes.js first?');
       }
       enc._encoding = encoding;
     } else {
@@ -1268,7 +1268,7 @@ if (typeof module !== "undefined" && module.exports) {
    * @return {!Uint8Array} Encoded bytes, as a Uint8Array.
    */
   TextEncoder.prototype.encode = function encode(opt_string, options) {
-    opt_string = opt_string ? String(opt_string) : '';
+    opt_string = opt_string === undefined ? '' : String(opt_string);
     options = ToDictionary(options);
 
     // NOTE: This option is nonstandard. None of the encodings
diff --git a/package.json b/package.json
index d46c443..7707c1b 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
     "Pierre Queinnec <pierre at queinnec.org>",
     "Zack Weinberg <zackw at panix.com>"
   ],
-  "version": "0.6.1",
+  "version": "0.6.2",
   "description": "Polyfill for the Encoding Living Standard's API.",
   "main": "index.js",
   "files": [
diff --git a/test/test-misc.js b/test/test-misc.js
index dc12036..d330711 100644
--- a/test/test-misc.js
+++ b/test/test-misc.js
@@ -379,3 +379,15 @@ test(function() {
 
   }, 'NONSTANDARD - ' + encoding + ' (encoding)');
 });
+
+test(function() {
+  var encoder = new TextEncoder();
+  assert_array_equals([].slice.call(encoder.encode(false)), [102, 97, 108, 115, 101]);
+  assert_array_equals([].slice.call(encoder.encode(0)), [48]);
+}, 'encode() called with falsy arguments (polyfill bindings)');
+
+test(function() {
+  // Regression test for https://github.com/inexorabletash/text-encoding/issues/59
+  assert_array_equals(
+    new TextDecoder('windows-1255').decode(new Uint8Array([0xCA])), '\u05BA');
+}, 'windows-1255 map 0xCA to U+05BA');

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-text-encoding.git



More information about the Pkg-javascript-commits mailing list