From 42a287e2aa13928771af9a34a698487171c803d9 Mon Sep 17 00:00:00 2001 From: Tuan Anh Tran <me@tuananh.org> Date: Wed, 27 Sep 2017 12:57:20 +0700 Subject: [PATCH] fix: titlecase wrong with unicode string --- package-lock.json | 2 +- package.json | 2 +- src/pugixml | 2 +- test/function.test.js | 13 +++++++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 39f6b0c..a723fdf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "camaro", - "version": "1.6.0", + "version": "2.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 83703d1..299da28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "camaro", - "version": "2.0.0", + "version": "2.0.1", "description": "Transforming XML to JSON using Node.js binding to native pugixml parser library", "homepage": "https://github.com/tuananh/camaro", "bugs": "https://github.com/tuananh/camaro/issues", diff --git a/src/pugixml b/src/pugixml index 89c1b3c..b8a6966 160000 --- a/src/pugixml +++ b/src/pugixml @@ -1 +1 @@ -Subproject commit 89c1b3c39a1e1397e2ef70a392a0f5c56a8ffe99 +Subproject commit b8a6966953e657731d8fb8a53d3a7ff981ca29c8 diff --git a/test/function.test.js b/test/function.test.js index f5b0de7..2a34335 100644 --- a/test/function.test.js +++ b/test/function.test.js @@ -13,6 +13,9 @@ const xml = ` <item>hello wOrld caMaro</item> <item>hEllO wOrlD camaRo</item> </items> + <unicode> + <item>phòng 2 người</item> + </unicode> </root> ` @@ -46,6 +49,16 @@ t.test('test function title-case()', (t) => { t.end() }) +t.test('test function title-case() unicode', (t) => { + const result = transform(xml, { + titleCase: ['//unicode/item', 'title-case(.)'] + }) + result.titleCase.forEach(u => { + t.equal(u, 'Phòng 2 Người') + }) + t.end() +}) + t.test('test function camel-case()', (t) => { const result = transform(xml, { camelCase: ['//items/item', 'camel-case(.)']