Skip to content
This repository was archived by the owner on Jan 7, 2021. It is now read-only.

Commit b143d11

Browse files
committed
Closes #94.
Coercing numeric values by default might take by surprise many people. This change disables coercion by default. Since this might break people's projects we are also bumping the major version.
1 parent fb6c20b commit b143d11

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Simple XML2JSON Parser
22
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/buglabs/node-xml2json?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3+
[![Build Status](https://travis-ci.org/buglabs/node-xml2json.svg?branch=master)](https://travis-ci.org/buglabs/node-xml2json)
34

45
It does not parse the following elements:
56

@@ -41,7 +42,7 @@ Default values:
4142
var options = {
4243
object: false,
4344
reversible: false,
44-
coerce: true,
45+
coerce: false,
4546
sanitize: true,
4647
trim: true,
4748
arrayNotation: false

lib/xml2json.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ module.exports = function(xml, _options) {
144144
var schema = {
145145
object: joi.boolean().default(false),
146146
reversible: joi.boolean().default(false),
147-
coerce: joi.alternatives([joi.boolean(), joi.object()]).default(true),
147+
coerce: joi.alternatives([joi.boolean(), joi.object()]).default(false),
148148
sanitize: joi.boolean().default(true),
149149
trim: joi.boolean().default(true),
150150
arrayNotation: joi.boolean().default(false)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xml2json",
3-
"version": "0.8.2",
3+
"version": "0.9.0",
44
"description": "Converts xml to json and vice-versa, using node-expat.",
55
"repository": "git://github.com/buglabs/node-xml2json.git",
66
"license": "MIT",

0 commit comments

Comments
 (0)