[Pkg-javascript-commits] [node-iconv-lite] 07/83: fix two bugs in gbk.js and package.json, speed up table function in index.js

matthew pideil mpideil-guest at moszumanska.debian.org
Tue Apr 1 19:56:45 UTC 2014


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

mpideil-guest pushed a commit to branch master
in repository node-iconv-lite.

commit 6e9a0cacc013442dfa0b016740064a024d479e6d
Author: Jinwu Zhan <jenkinv at 163.com>
Date:   Thu Nov 24 09:48:38 2011 +0800

    fix two bugs in gbk.js and package.json,speed up table function in index.js
---
 encodings/table/gbk.js |  2 +-
 index.js               | 13 ++++++++-----
 package.json           |  2 +-
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/encodings/table/gbk.js b/encodings/table/gbk.js
index 3692a15..c464623 100644
--- a/encodings/table/gbk.js
+++ b/encodings/table/gbk.js
@@ -1 +1 @@
-module.exports={33088:19970,33089:19972,33090:19973,33091:19974,33092:19983,33093:19986,33094:19991,33095:19999,33096:20000,33097:20001,33098:20003,33099:20006,33100:20009,33101:20014,33102:20015,33103:20017,33104:20019,33105:20021,33106:20023,33107:20028,33108:20032,33109:20033,33110:20034,33111:20036,33112:20038,33113:20042,33114:20049,33115:20053,33116:20055,33117:20058,33118:20059,33119:20066,33120:20067,33121:20068,33122:20069,33123:20071,33124:20072,33125:20074,33126:20075,33127:20 [...]
\ No newline at end of file
+module.exports={33088:19970,33089:19972,33090:19973,33091:19974,33092:19983,33093:19986,33094:19991,33095:19999,33096:20000,33097:20001,33098:20003,33099:20006,33100:20009,33101:20014,33102:20015,33103:20017,33104:20019,33105:20021,33106:20023,33107:20028,33108:20032,33109:20033,33110:20034,33111:20036,33112:20038,33113:20042,33114:20049,33115:20053,33116:20055,33117:20058,33118:20059,33119:20066,33120:20067,33121:20068,33122:20069,33123:20071,33124:20072,33125:20074,33126:20075,33127:20 [...]
\ No newline at end of file
diff --git a/index.js b/index.js
index 5f03f5a..e26cf92 100644
--- a/index.js
+++ b/index.js
@@ -116,14 +116,17 @@ module.exports = iconv = {
 
         // Codepage double-byte encodings.
         table: function(options) {
-            if (!options.table) {
+            var table = options.table, key, revCharsTable = options.revCharsTable;
+            if (!table) {
                 throw new Error("Encoding '" + options.type +"' has incorect 'table' option");
             }
-            var table = options.table, key,
-                revCharsTable = {};
-            for (key in table) {
-                revCharsTable[table[key]] = parseInt(key);
+            if(!revCharsTable) {
+                revCharsTable = options.revCharsTable = {};
+                for (key in table) {
+                    revCharsTable[table[key]] = parseInt(key);
+                }
             }
+            
             return {
                 toEncoding: function(str) {
                     str = ensureString(str);
diff --git a/package.json b/package.json
index 4222638..2fe85c0 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,6 @@
     },
     "devDependencies": {
         "vows": "",
-        "iconv": "",
+        "iconv": ""
     }
 }

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



More information about the Pkg-javascript-commits mailing list