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

@buzuli/json

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@buzuli/json - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

10

example.js

@@ -26,7 +26,7 @@ const json = require('./lib/json')

D: {},
"\"E\"": '"quoted"',
"\\F\\": "\\escaped\\",
"\\G\\": "\nnewlines\n",
"\\H\\": '"',
"\\I\\": '',
'"E"': '"quoted"',
'\\F\\': '\\escaped\\',
'\\G\\': '\nnewlines\n',
'\\H\\': '"',
'\\I\\': '',
'some-thing': 'hyphenated'

@@ -33,0 +33,0 @@ }

module.exports = json
const {blue, green, orange, purple, yellow} = require('@buzuli/color')
const { blue, green, orange, purple, yellow } = require('@buzuli/color')

@@ -9,2 +9,6 @@ function json (obj) {

if (typeof obj === 'string') {
obj = JSON.parse(obj)
}
_json(obj, null, 0)

@@ -36,4 +40,4 @@

entries.length > 0
? `\n${' '.repeat(depth)}]${suffix}`
: `]${suffix}`
? `\n${' '.repeat(depth)}]${suffix}`
: `]${suffix}`
)

@@ -40,0 +44,0 @@ } else if (typeof value === 'boolean') {

{
"name": "@buzuli/json",
"version": "1.2.0",
"version": "1.3.0",
"description": "",

@@ -26,5 +26,5 @@ "main": "lib/json.js",

"devDependencies": {
"standard": "^11.0.1",
"tap": "^11.1.2"
"standard": "^12.0.1",
"tap": "^12.1.1"
}
}
const tap = require('tap')
const json = require('../lib/json')
tap.test('', t => {
tap.test('Should format an object', async assert => {
const obj = {

@@ -28,5 +28,7 @@ A: [

t.ok(typeof json(obj) === 'string')
assert.ok(typeof json(obj) === 'string')
})
t.done()
tap.test('Should parse a string then format', async assert => {
assert.ok(typeof json('{}') === 'string')
})
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