json-ascii
Advanced tools
Comparing version 3.3.1 to 3.3.2
@@ -67,2 +67,30 @@ 'use strict' | ||
}) | ||
it('the string null for objects and arrays should remain untouched becuase its messed up. in the data stream', () => { | ||
const objectToEncode = { | ||
str: 'foo', | ||
bar: 'null', | ||
array: 'null', | ||
untouched: 123 | ||
} | ||
const encodedObject = objectPropertyEncoder.encode(objectToEncode, { | ||
str: {}, | ||
array: {type: 'array'}, | ||
bar: {type: 'object'}, | ||
foobar: {type: 'object'} | ||
}) | ||
assertObjectEqual({ | ||
str: 'Zm9v', | ||
array: 'null', | ||
bar: 'null', | ||
untouched: 123 | ||
}, encodedObject) | ||
const decodedObject = objectPropertyEncoder.decode(encodedObject, { | ||
str: {}, | ||
array: {type: 'array'}, | ||
bar: {type: 'object'}, | ||
foobar: {type: 'object'} | ||
}) | ||
assertObjectEqual(objectToEncode, decodedObject) | ||
}) | ||
}) |
@@ -11,3 +11,3 @@ 'use strict' | ||
_.each(_.keys(fieldListConfiguration), (field) => { | ||
if (_.isString(returnObject[field])) { | ||
if (_.isString(returnObject[field]) && !_.isEqual('null', returnObject[field])) { | ||
returnObject[field] = Buffer.from(returnObject[field]).toString('base64') | ||
@@ -30,3 +30,3 @@ } else if (_.isObject(returnObject[field]) || _.isArray(returnObject[field])) { | ||
if (type && _.includes(['object', 'array'], type)) { | ||
if (_.isString(returnObject[field])) { | ||
if (_.isString(returnObject[field]) && !_.isEqual('null', returnObject[field])) { | ||
const jsonString = Buffer.from(returnObject[field], 'base64').toString('utf-8') | ||
@@ -33,0 +33,0 @@ returnObject[field] = JSON.parse(jsonString) |
{ | ||
"name": "json-ascii", | ||
"version": "3.3.1", | ||
"version": "3.3.2", | ||
"description": "encodes and decodes utf8 four byte characters", | ||
@@ -5,0 +5,0 @@ "main": "json-ascii.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10044
258