[Groonga-commit] groonga/gcs [master] Convert attribute values to uint correctly

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Mon Dec 10 17:19:43 JST 2012


YUKI Hiroshi	2012-12-10 17:19:43 +0900 (Mon, 10 Dec 2012)

  New Revision: fff1723b2fb9d3ff208d1e40996edf796f426f1c
  https://github.com/groonga/gcs/commit/fff1723b2fb9d3ff208d1e40996edf796f426f1c

  Log:
    Convert attribute values to uint correctly

  Modified files:
    lib/batch/xml.js

  Modified: lib/batch/xml.js (+5 -1)
===================================================================
--- lib/batch/xml.js    2012-12-10 17:18:23 +0900 (894f9a2)
+++ lib/batch/xml.js    2012-12-10 17:19:43 +0900 (be2342e)
@@ -29,17 +29,21 @@ function toJSON(xml) {
       var batch = {
             type: 'add',
             id: item['@'].id,
-            version: item['@'].version,
+            version: parseInt(item['@'].version),
             lang: item['@'].lang,
             fields: {}
           };
+      if (UINT_MATCHER.test(batch.id)) batch.id = parseInt(batch.id);
+
       var fields = item.field;
       if (!Array.isArray(fields)) fields = [fields];
+
       fields.forEach(function(field) {
         var value = field['#'];
         if (UINT_MATCHER.test(value)) value = parseInt(value);
         batch.fields[field['@'].name] = value;
       });
+
       batches.push(batch);
     });
   }
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index