Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-ascii

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-ascii - npm Package Compare versions

Comparing version 3.3.1 to 3.3.2

28

__test__/object-property-base64-encoder-test.js

@@ -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)
})
})

4

object-property-base64-encoder.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc